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 \
()
| 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 |
nothing calls this directly
no test coverage detected