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

Method readFirstLine

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

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

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

createMethod · 0.95
registerMethod · 0.95
openBufferedStreamMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
readLineMethod · 0.65

Tested by

no test coverage detected