equivalent to Files.readAllLines() for InputStream or Reader?

Solution 1:

An InputStream represents a stream of bytes. Those bytes don't necessarily form (text) content that can be read line by line.

If you know that the InputStream can be interpreted as text, you can wrap it in a InputStreamReader and use BufferedReader#lines() to consume it line by line.

try (InputStream resource = Example.class.getResourceAsStream("resource")) {
  List<String> doc =
      new BufferedReader(new InputStreamReader(resource,
          StandardCharsets.UTF_8)).lines().collect(Collectors.toList());
}

Solution 2:

You can use Apache Commons IOUtils#readLines:

List<String> doc = IOUtils.readLines(inputStream, StandardCharsets.UTF_8);