@RestrictedApi(explanation = "Should only be called in tests", link = "",
      allowedOnPath = ".*/RotateFile.java|.*/src/test/.*")
  static void write(FileSystem fs, Path file, long timestamp, byte[] data) throws IOException {
    HBaseProtos.RotateFileData proto = HBaseProtos.RotateFileData.newBuilder()
      .setTimestamp(timestamp).setData(ByteString.copyFrom(data)).build();
    byte[] protoData = proto.toByteArray();
    CRC32 crc32 = new CRC32();
    crc32.update(protoData);
    int checksum = (int) crc32.getValue();
    // 4 bytes length, 8 bytes timestamp, 4 bytes checksum at the end
    try (FSDataOutputStream out = fs.create(file, true)) {
      out.writeInt(protoData.length);
      out.write(protoData);
      out.writeInt(checksum);
    }
  }
Reads the content of the rotate file by selecting the winner file based on the timestamp of the
data inside the files. It reads the content of both files and selects the one with the latest
timestamp as the winner. If a file is incomplete or does not exist, it logs the error and moves
on to the next file. It returns the content of the winner file as a byte array. If none of the
files have valid data, it returns null.
@return a byte array containing the data from the winner file, or null if no valid data is
        found.
@throws IOException if an error occurs while reading the files.
hbase-client/src/main/java/org/apache/hadoop/hbase/util/RotateFile.java