remove field references to JSONTokener and JSONParserConfiguration in JSONArray

and JSONObject
This commit is contained in:
Michael Ameri
2025-01-10 18:03:05 +01:00
parent 391c86931b
commit ca1c6830c9
3 changed files with 38 additions and 54 deletions

View File

@@ -40,7 +40,8 @@ public class JSONTokener {
*
* @param reader A reader.
*/
public JSONTokener(Reader reader) {
public JSONTokener(Reader reader, JSONParserConfiguration jsonParserConfiguration) {
this.jsonParserConfiguration = jsonParserConfiguration;
this.reader = reader.markSupported()
? reader
: new BufferedReader(reader);
@@ -53,13 +54,24 @@ 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.
*/
public JSONTokener(InputStream inputStream) {
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
this(inputStream, new JSONParserConfiguration());
}
/**
* Construct a JSONTokener from an InputStream. The caller must close the input stream.
* @param inputStream The source.
*/
public JSONTokener(InputStream inputStream, JSONParserConfiguration jsonParserConfiguration) {
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")),jsonParserConfiguration);
}
@@ -72,6 +84,10 @@ public class JSONTokener {
this(new StringReader(s));
}
public JSONTokener(String s, JSONParserConfiguration jsonParserConfiguration) {
this(new StringReader(s), jsonParserConfiguration);
}
/**
* Getter
* @return jsonParserConfiguration