private HFileBlock getSampleHFileBlock(List<KeyValue> kvs, boolean useTag) {
    ByteBuffer keyValues = RedundantKVGenerator.convertKvToByteBuffer(kvs, includesMemstoreTS);
    int size = keyValues.limit();
    ByteBuffer buf = ByteBuffer.allocate(size + HConstants.HFILEBLOCK_HEADER_SIZE);
    buf.position(HConstants.HFILEBLOCK_HEADER_SIZE);
    keyValues.rewind();
    buf.put(keyValues);
    HFileContext meta = new HFileContextBuilder().withIncludesMvcc(includesMemstoreTS)
      .withIncludesTags(useTag).withHBaseCheckSum(true).withCompression(Algorithm.NONE)
      .withBlockSize(0).withChecksumType(ChecksumType.NULL).build();
    HFileBlock b = new HFileBlock(BlockType.DATA, size, size, -1, ByteBuff.wrap(buf),
      HFileBlock.FILL_HEADER, 0, 0, -1, meta, ByteBuffAllocator.HEAP);
    return b;
  }
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