From 16baa323cff49ff9000bc7aa0a90791be84d5627 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 26 Jun 2017 10:32:02 -0400 Subject: [PATCH] adds comments --- JSONTokener.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/JSONTokener.java b/JSONTokener.java index 741e78b..36bce45 100644 --- a/JSONTokener.java +++ b/JSONTokener.java @@ -144,6 +144,8 @@ public class JSONTokener { } /** + * Checks if the end of the input has been reached. + * * @return true if at the end of the file and we didn't step back */ public boolean end() { @@ -168,7 +170,8 @@ public class JSONTokener { throw new JSONException("Unable to preserve stream position", e); } try { - if(this.reader.read()<0) { + // -1 is EOF, but next() can not consume the null character '\0' + if(this.reader.read() <= 0) { this.eof = true; return false; }