Skip to content

Commit 16baa32

Browse files
John J. Aylwardjohnjaylward
authored andcommitted
adds comments
1 parent 5284536 commit 16baa32

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

JSONTokener.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ public static int dehexchar(char c) {
144144
}
145145

146146
/**
147+
* Checks if the end of the input has been reached.
148+
*
147149
* @return true if at the end of the file and we didn't step back
148150
*/
149151
public boolean end() {
@@ -168,7 +170,8 @@ public boolean more() throws JSONException {
168170
throw new JSONException("Unable to preserve stream position", e);
169171
}
170172
try {
171-
if(this.reader.read()<0) {
173+
// -1 is EOF, but next() can not consume the null character '\0'
174+
if(this.reader.read() <= 0) {
172175
this.eof = true;
173176
return false;
174177
}

0 commit comments

Comments
 (0)