HFileProtos.FileTrailerProto toProtobuf() {
    HFileProtos.FileTrailerProto.Builder builder = HFileProtos.FileTrailerProto.newBuilder()
      .setFileInfoOffset(fileInfoOffset).setLoadOnOpenDataOffset(loadOnOpenDataOffset)
      .setUncompressedDataIndexSize(uncompressedDataIndexSize)
      .setTotalUncompressedBytes(totalUncompressedBytes).setDataIndexCount(dataIndexCount)
      .setMetaIndexCount(metaIndexCount).setEntryCount(entryCount)
      .setNumDataIndexLevels(numDataIndexLevels).setFirstDataBlockOffset(firstDataBlockOffset)
      .setLastDataBlockOffset(lastDataBlockOffset).setComparatorClassName(comparatorClassName)
      .setCompressionCodec(compressionCodec.ordinal());
    if (encryptionKey != null) {
      builder.setEncryptionKey(UnsafeByteOperations.unsafeWrap(encryptionKey));
    }
    return builder.build();
  }
Write the trailer to a data stream. We support writing version 1 for testing and for
determining version 1 trailer size. It is also easy to see what fields changed in version 2.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java