Java Code Examples for javax.tools.JavaFileObject.openReader()

The following are Jave code examples for showing how to use openReader() of the javax.tools.JavaFileObject class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jtsgen   File: OutputHelper.java   View Source Code Vote up 5 votes
public static List<String> findSourceLine(Compilation c, String packageName, String fileName, Pattern pattern) throws IOException {
    Assert.assertTrue(c.generatedFile(StandardLocation.SOURCE_OUTPUT,packageName, fileName).isPresent());
    JavaFileObject jfo = c.generatedFile(StandardLocation.SOURCE_OUTPUT,packageName, fileName).get();
    try (Reader r = jfo.openReader(false)) {
        return IOUtils.readLines(r).stream().filter( (x) -> pattern.matcher(x).find()).collect(Collectors.toList());
    }
}