MCPcopy Create free account
hub / github.com/antlr/codebuff / readLines

Method readLines

output/java_guava/1.4.19/Files.java:551–568  ·  view source on GitHub ↗

Reads all of the lines from a file. The lines do not include line-termination characters, but do include other leading and trailing whitespace. This method returns a mutable List. For an ImmutableList, use Files.asCharSource(file, charset).readLines(). @param file the fi

(File file, Charset charset)

Source from the content-addressed store, hash-verified

549
550
551 public static List<String> readLines(File file, Charset charset) throws IOException {
552 // don't use asCharSource(file, charset).readLines() because that returns
553 // an immutable list, which would change the behavior of this method
554 return readLines(file, charset, new LineProcessor<List<String>>() {
555 final List<String> result = Lists.newArrayList();
556
557 @Override
558 public boolean processLine(String line) {
559 result.add(line);
560 return true;
561 }
562
563 @Override
564 public List<String> getResult() {
565 return result;
566 }
567 });
568 }
569
570 /**
571 * Streams lines from a {@link File}, stopping when our callback returns false, or we have read

Callers

nothing calls this directly

Calls 2

newArrayListMethod · 0.95
asCharSourceMethod · 0.95

Tested by

no test coverage detected