private static String getEvent(FileSystem fs, Path path) throws IOException {
    try (FSDataInputStream fdis = fs.open(path);
         BufferedReader br = new BufferedReader(new InputStreamReader(fdis))) {
      // Assumes event is at least on first line.
      String line = br.readLine();
      Assert.assertNotNull(line);
      // Assumes event is present.
      int index = line.indexOf("\t");
      Assert.assertNotEquals(-1, index);
      String event = line.substring(0, index);
      LOG.info("Reading event file: " + path.toString() + " : " + event + ", raw: " + line);
      return event;
    }
  }
ReplicationTestUtils - static helper functions for replication test
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/ReplicationTestUtils.java