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

Method readLine

corpus/java/training/guava/io/LineReader.java:72–88  ·  view source on GitHub ↗

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed ("\r\n"). @return a String containing the contents of the line, not including any line-

()

Source from the content-addressed store, hash-verified

70 * @throws IOException if an I/O error occurs
71 */
72 @CanIgnoreReturnValue // to skip a line
73 public String readLine() throws IOException {
74 while (lines.peek() == null) {
75 cbuf.clear();
76 // The default implementation of Reader#read(CharBuffer) allocates a
77 // temporary char[], so we call Reader#read(char[], int, int) instead.
78 int read = (reader != null)
79 ? reader.read(buf, 0, buf.length)
80 : readable.read(cbuf);
81 if (read == -1) {
82 lineBuf.finish();
83 break;
84 }
85 lineBuf.add(buf, 0, read);
86 }
87 return lines.poll();
88 }
89}

Callers 1

readLinesMethod · 0.95

Calls 6

peekMethod · 0.65
clearMethod · 0.65
addMethod · 0.65
readMethod · 0.45
finishMethod · 0.45
pollMethod · 0.45

Tested by

no test coverage detected