MCPcopy
hub / github.com/google/guava / readLines

Method readLines

guava/src/com/google/common/io/CharSource.java:335–350  ·  view source on GitHub ↗

Reads all the lines of this source as a list of strings. The returned list will be empty if this source is empty. <p>Like {@link BufferedReader#readLine()}, this method considers a line to be a sequence of text that is terminated by (but does not include) one of {@code \r\n}, {@code \r} or {@code \

()

Source from the content-addressed store, hash-verified

333 * @throws IOException if an I/O error occurs while reading from this source
334 */
335 public ImmutableList<String> readLines() throws IOException {
336 Closer closer = Closer.create();
337 try {
338 BufferedReader reader = closer.register(openBufferedStream());
339 List<String> result = new ArrayList<>();
340 String line;
341 while ((line = reader.readLine()) != null) {
342 result.add(line);
343 }
344 return ImmutableList.copyOf(result);
345 } catch (Throwable e) {
346 throw closer.rethrow(e);
347 } finally {
348 closer.close();
349 }
350 }
351
352 /**
353 * Reads lines of text from this source, processing each line as it is read using the given {@link

Callers

nothing calls this directly

Calls 11

createMethod · 0.95
registerMethod · 0.95
openBufferedStreamMethod · 0.95
copyOfMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
openStreamMethod · 0.95
readLinesMethod · 0.95
readLineMethod · 0.65
addMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected