private void writeBlock(Configuration conf, List<ExtendedCell> kvs, HFileContext fileContext,
    boolean useTags) throws IOException {
    HFileBlockEncodingContext context = new HFileBlockDefaultEncodingContext(conf,
      blockEncoder.getDataBlockEncoding(), HConstants.HFILEBLOCK_DUMMY_HEADER, fileContext);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    baos.write(HConstants.HFILEBLOCK_DUMMY_HEADER);
    DataOutputStream dos = new DataOutputStream(baos);
    blockEncoder.startBlockEncoding(context, dos);
    for (ExtendedCell kv : kvs) {
      blockEncoder.encode(kv, context, dos);
    }
  }
Test encoding with offheap keyvalue. This test just verifies if the encoders work with DBB and
does not use the getXXXArray() API
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileDataBlockEncoder.java