Skip to content

Commit 215f426

Browse files
committed
add Javadoc and rename parameters to speaking variable names
1 parent ca1c683 commit 215f426

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

src/main/java/org/json/JSONTokener.java

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ public class JSONTokener {
3838
/**
3939
* Construct a JSONTokener from a Reader. The caller must close the Reader.
4040
*
41-
* @param reader A reader.
41+
* @param reader the source.
42+
*/
43+
public JSONTokener(Reader reader) {
44+
this(reader, new JSONParserConfiguration());
45+
}
46+
47+
/**
48+
* Construct a JSONTokener from a Reader with a given JSONParserConfiguration. The caller must close the Reader.
49+
*
50+
* @param reader the source.
51+
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
52+
*
4253
*/
4354
public JSONTokener(Reader reader, JSONParserConfiguration jsonParserConfiguration) {
4455
this.jsonParserConfiguration = jsonParserConfiguration;
@@ -54,10 +65,6 @@ public JSONTokener(Reader reader, JSONParserConfiguration jsonParserConfiguratio
5465
this.line = 1;
5566
}
5667

57-
public JSONTokener(Reader reader) {
58-
this(reader, new JSONParserConfiguration());
59-
}
60-
6168
/**
6269
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
6370
* @param inputStream The source.
@@ -69,23 +76,29 @@ public JSONTokener(InputStream inputStream) {
6976
/**
7077
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
7178
* @param inputStream The source.
79+
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
7280
*/
7381
public JSONTokener(InputStream inputStream, JSONParserConfiguration jsonParserConfiguration) {
74-
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")),jsonParserConfiguration);
82+
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")), jsonParserConfiguration);
7583
}
7684

7785

7886
/**
7987
* Construct a JSONTokener from a string.
8088
*
81-
* @param s A source string.
89+
* @param source A source string.
8290
*/
83-
public JSONTokener(String s) {
84-
this(new StringReader(s));
91+
public JSONTokener(String source) {
92+
this(new StringReader(source));
8593
}
8694

87-
public JSONTokener(String s, JSONParserConfiguration jsonParserConfiguration) {
88-
this(new StringReader(s), jsonParserConfiguration);
95+
/**
96+
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
97+
* @param source The source.
98+
* @param jsonParserConfiguration A JSONParserConfiguration instance that controls the behavior of the parser.
99+
*/
100+
public JSONTokener(String source, JSONParserConfiguration jsonParserConfiguration) {
101+
this(new StringReader(source), jsonParserConfiguration);
89102
}
90103

91104
/**

0 commit comments

Comments
 (0)