public static int count(WALFactory walFactory, FileSystem fs, Path path) throws IOException {
    try (NoEOFWALStreamReader reader = create(walFactory, fs, path)) {
      return reader.count();
    }
  }
A helper class for writing UTs, where we will eat the EOF and return null when reaching EOF, so
in UTs we do not need to deal with partial WAL files if this does not affect the correctness. In
production code you usually you should not do this, as it may cause data loss if you always
ignore the EOFException.
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/NoEOFWALStreamReader.java