@@ -71,7 +71,7 @@ public JSONTokener(Reader reader) {
7171 * Construct a JSONTokener from an InputStream.
7272 * @param inputStream The source.
7373 */
74- public JSONTokener (InputStream inputStream ) throws JSONException {
74+ public JSONTokener (InputStream inputStream ) {
7575 this (new InputStreamReader (inputStream ));
7676 }
7777
@@ -90,6 +90,8 @@ public JSONTokener(String s) {
9090 * Back up one character. This provides a sort of lookahead capability,
9191 * so that you can test for a digit or letter before attempting to parse
9292 * the next number or identifier.
93+ * @throws JSONException Thrown if trying to step back more than 1 step
94+ * or if already at the start of the string
9395 */
9496 public void back () throws JSONException {
9597 if (this .usePrevious || this .index <= 0 ) {
@@ -121,6 +123,9 @@ public static int dehexchar(char c) {
121123 return -1 ;
122124 }
123125
126+ /**
127+ * @return true if at the end of the file and we didn't step back
128+ */
124129 public boolean end () {
125130 return this .eof && !this .usePrevious ;
126131 }
@@ -130,6 +135,8 @@ public boolean end() {
130135 * Determine if the source string still contains characters that next()
131136 * can consume.
132137 * @return true if not yet at the end of the source.
138+ * @throws JSONException thrown if there is an error stepping forward
139+ * or backward while checking for more data.
133140 */
134141 public boolean more () throws JSONException {
135142 this .next ();
@@ -145,6 +152,7 @@ public boolean more() throws JSONException {
145152 * Get the next character in the source string.
146153 *
147154 * @return The next character, or 0 if past the end of the source string.
155+ * @throws JSONException Thrown if there is an error reading the source string.
148156 */
149157 public char next () throws JSONException {
150158 int c ;
@@ -225,7 +233,7 @@ public String next(int n) throws JSONException {
225233
226234 /**
227235 * Get the next char in the string, skipping whitespace.
228- * @throws JSONException
236+ * @throws JSONException Thrown if there is an error reading the source string.
229237 * @return A character, or 0 if there are no more characters.
230238 */
231239 public char nextClean () throws JSONException {
@@ -309,6 +317,8 @@ public String nextString(char quote) throws JSONException {
309317 * end of line, whichever comes first.
310318 * @param delimiter A delimiter character.
311319 * @return A string.
320+ * @throws JSONException Thrown if there is an error while searching
321+ * for the delimiter
312322 */
313323 public String nextTo (char delimiter ) throws JSONException {
314324 StringBuilder sb = new StringBuilder ();
@@ -330,6 +340,8 @@ public String nextTo(char delimiter) throws JSONException {
330340 * characters or the end of line, whichever comes first.
331341 * @param delimiters A set of delimiter characters.
332342 * @return A string, trimmed.
343+ * @throws JSONException Thrown if there is an error while searching
344+ * for the delimiter
333345 */
334346 public String nextTo (String delimiters ) throws JSONException {
335347 char c ;
@@ -401,6 +413,8 @@ public Object nextValue() throws JSONException {
401413 * @param to A character to skip to.
402414 * @return The requested character, or zero if the requested character
403415 * is not found.
416+ * @throws JSONException Thrown if there is an error while searching
417+ * for the to character
404418 */
405419 public char skipTo (char to ) throws JSONException {
406420 char c ;
@@ -453,6 +467,7 @@ public JSONException syntaxError(String message, Throwable causedBy) {
453467 *
454468 * @return " at {index} [character {character} line {line}]"
455469 */
470+ @ Override
456471 public String toString () {
457472 return " at " + this .index + " [character " + this .character + " line " +
458473 this .line + "]" ;
0 commit comments