@Override
  public void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out,
    byte[] uncompressedBytesWithHeader) throws IOException {
    EncodingState state = encodingCtx.getEncodingState();
    // Write the unencodedDataSizeWritten (with header size)
    Bytes.putInt(uncompressedBytesWithHeader,
      HConstants.HFILEBLOCK_HEADER_SIZE + DataBlockEncoding.ID_SIZE,
      state.getUnencodedDataSizeWritten());
    postEncoding(encodingCtx);
  }
Asserts that there is at least the given amount of unfilled space remaining in the given
buffer.
@param out    typically, the buffer we are writing to
@param length the required space in the buffer
@throws EncoderBufferTooSmallException If there are no enough bytes.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java