Reads the first line of this source as a string. Returns {@code null} 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 \n}. If the source's
()
| 310 | * @throws IOException if an I/O error occurs while reading from this source |
| 311 | */ |
| 312 | public @Nullable String readFirstLine() throws IOException { |
| 313 | Closer closer = Closer.create(); |
| 314 | try { |
| 315 | BufferedReader reader = closer.register(openBufferedStream()); |
| 316 | return reader.readLine(); |
| 317 | } catch (Throwable e) { |
| 318 | throw closer.rethrow(e); |
| 319 | } finally { |
| 320 | closer.close(); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * Reads all the lines of this source as a list of strings. The returned list will be empty if |