@Override
  public void encode(ExtendedCell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out)
    throws IOException {
    EncodingState state = encodingCtx.getEncodingState();
    int posBeforeEncode = out.size();
    int encodedKvSize = internalEncode(cell, (HFileBlockDefaultEncodingContext) encodingCtx, out);
    state.postCellEncode(encodedKvSize, out.size() - posBeforeEncode);
  }
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