private void doRead(boolean withTrailer) throws IOException {
    int columnCount = 5;
    int recordCount = 5;
    TableName tableName = TableName.valueOf("tablename");
    byte[] row = Bytes.toBytes("row");
    long timestamp = EnvironmentEdgeManager.currentTime();
    Path path = new Path(dir, "tempwal");
    // delete the log if already exists, for test only
    fs.delete(path, true);
    fs.mkdirs(dir);
    try (WALProvider.Writer writer = createWriter(path)) {
      ProtobufLogTestHelper.doWrite(writer, withTrailer, tableName, columnCount, recordCount, row,
        timestamp);
      try (ProtobufWALStreamReader reader =
        (ProtobufWALStreamReader) wals.createStreamReader(fs, path)) {
        ProtobufLogTestHelper.doRead(reader, withTrailer, tableName, columnCount, recordCount, row,
          timestamp);
      }
    }
  }
Appends entries in the WAL and reads it.
@param withTrailer If 'withTrailer' is true, it calls a close on the WALwriter before reading
                   so that a trailer is appended to the WAL. Otherwise, it starts reading after
                   the sync call. This means that reader is not aware of the trailer. In this
                   scenario, if the reader tries to read the trailer in its next() call, it
                   returns false from ProtoBufLogReader.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestProtobufLog.java