From 215f4268bfe10e560c2129f5442a0bb04dd32f9a Mon Sep 17 00:00:00 2001 From: Simulant Date: Sat, 11 Jan 2025 21:35:36 +0100 Subject: [PATCH] add Javadoc and rename parameters to speaking variable names --- src/main/java/org/json/JSONTokener.java | 35 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/json/JSONTokener.java b/src/main/java/org/json/JSONTokener.java index b6aee11..c17907c 100644 --- a/src/main/java/org/json/JSONTokener.java +++ b/src/main/java/org/json/JSONTokener.java @@ -38,7 +38,18 @@ public class JSONTokener { /** * Construct a JSONTokener from a Reader. The caller must close the Reader. * - * @param reader A reader. + * @param reader the source. + */ + public JSONTokener(Reader reader) { + this(reader, new JSONParserConfiguration()); + } + + /** + * Construct a JSONTokener from a Reader with a given JSONParserConfiguration. The caller must close the Reader. + * + * @param reader the source. + * @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser. + * */ public JSONTokener(Reader reader, JSONParserConfiguration jsonParserConfiguration) { this.jsonParserConfiguration = jsonParserConfiguration; @@ -54,10 +65,6 @@ public class JSONTokener { this.line = 1; } - public JSONTokener(Reader reader) { - this(reader, new JSONParserConfiguration()); - } - /** * Construct a JSONTokener from an InputStream. The caller must close the input stream. * @param inputStream The source. @@ -69,23 +76,29 @@ public class JSONTokener { /** * Construct a JSONTokener from an InputStream. The caller must close the input stream. * @param inputStream The source. + * @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser. */ public JSONTokener(InputStream inputStream, JSONParserConfiguration jsonParserConfiguration) { - this(new InputStreamReader(inputStream, Charset.forName("UTF-8")),jsonParserConfiguration); + this(new InputStreamReader(inputStream, Charset.forName("UTF-8")), jsonParserConfiguration); } /** * Construct a JSONTokener from a string. * - * @param s A source string. + * @param source A source string. */ - public JSONTokener(String s) { - this(new StringReader(s)); + public JSONTokener(String source) { + this(new StringReader(source)); } - public JSONTokener(String s, JSONParserConfiguration jsonParserConfiguration) { - this(new StringReader(s), jsonParserConfiguration); + /** + * Construct a JSONTokener from an InputStream. The caller must close the input stream. + * @param source The source. + * @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser. + */ + public JSONTokener(String source, JSONParserConfiguration jsonParserConfiguration) { + this(new StringReader(source), jsonParserConfiguration); } /**