MetaInfReader { public static Stream<String> readLines(String fileName) throws IOException { checkNotNull(fileName, "fileName"); InputStream stream = MetaInfReader.class.getResourceAsStream("/META-INF/" + fileName); if (stream == null) { throw new IOException("No resource /META-INF/" + fileName + " found"); } return readLines(stream); } private  MetaInfReader(); static Stream<Class<T>> readClasses(String fileName); static Stream<String> readLines(String fileName);  }
@Test public void testRead() throws IOException { String input = "# Leading comment\na\nb\n# Comment in the middle\n\nc\nd\ne # Trailing comment"; List<String> expected = ImmutableList.of("a", "b", "c", "d", "e"); InputStream s = new StringBufferInputStream(input); List<String> out = MetaInfReader.readLines(s) .collect(Collectors.toList()); assertEquals("Unexpected line result", expected, out); }