private static void writeHFile(Configuration conf, CacheConfig cc, FileSystem fs, Path path,
    HFileContext cxt, int entryCount) throws IOException {
    HFile.Writer writer =
      new HFile.WriterFactory(conf, cc).withPath(fs, path).withFileContext(cxt).create();

    // write a bunch of random kvs
    final byte[] family = Bytes.toBytes("f");
    final byte[] qualifier = Bytes.toBytes("q");
    for (int i = 0; i < entryCount; i++) {
      byte[] keyBytes = RandomKeyValueUtil.randomOrderedKey(RNG, i);
      byte[] valueBytes = RandomKeyValueUtil.randomValue(RNG);
      // make a real keyvalue so that hfile tool can examine it
      writer.append(new KeyValue(keyBytes, family, qualifier, valueBytes));
    }
    writer.close();
  }
Write {@code entryCount} random keyvalues to a new HFile at {@code path}. Returns the row bytes
of the KeyValues written, in the order they were written.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLazyDataBlockDecompression.java