MCPcopy Create free account
hub / github.com/ReadyTalk/avian / readLine

Method readLine

classpath/java/io/BufferedReader.java:33–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 }
32
33 public String readLine() throws IOException {
34 StringBuilder sb = new StringBuilder();
35 while (true) {
36 if (position >= limit) {
37 fill();
38 }
39
40 if (position >= limit) {
41 return sb.length() == 0 ? null : sb.toString();
42 }
43
44 for (int i = position; i < limit; ++i) {
45 if(buffer[i] == '\r') {
46 sb.append(buffer, position, i - position);
47 position = i + 1;
48 if(i+1 < limit && buffer[i+1] == '\n') {
49 position = i + 2;
50 }
51 return sb.toString();
52 } else if (buffer[i] == '\n') {
53 sb.append(buffer, position, i - position);
54 position = i + 1;
55 return sb.toString();
56 }
57 }
58 sb.append(buffer, position, limit-position);
59 position = limit;
60 }
61 }
62
63 public int read(char[] b, int offset, int length) throws IOException {
64 int count = 0;

Callers 2

verifyContentsMethod · 0.95
mainMethod · 0.95

Calls 4

fillMethod · 0.95
lengthMethod · 0.95
toStringMethod · 0.95
appendMethod · 0.95

Tested by 2

verifyContentsMethod · 0.76
mainMethod · 0.76