public class JSONStrictTokener extends JSONTokener
For a lenient parse, use JSONTokener
.
JSONTokener.JSONToken
Constructor and Description |
---|
JSONStrictTokener(java.io.InputStream inputStream,
java.nio.charset.Charset charset)
Construct a JSONStrictTokener from an InputStream and supplied Charset.
|
JSONStrictTokener(java.io.Reader reader)
Construct a JSONStrictTokener from a Reader.
|
JSONStrictTokener(java.lang.String s)
Construct a JSONStrictTokener from a string.
|
Modifier and Type | Method and Description |
---|---|
char |
nextClean()
Get the next char in the stream, skipping insignificant whitespace.
|
protected JSONArray |
nextJSONArray()
Parse a JSON array strictly according to the JSON specification.
|
protected JSONObject |
nextJSONObject()
Parse a JSON object strictly according to the JSON specification.
|
java.lang.String |
nextKey()
Get the next key.
|
protected java.lang.Number |
nextNumber()
Parse a number strictly according to the JSON specification.
|
java.lang.String |
nextString(char quote)
Return the characters up to the next close quote character.
|
JSONTokener.JSONToken |
nextTokenType()
Get the type of the next token in the stream, skipping whitespace.
|
java.lang.Object |
nextValue()
Get the next value.
|
static JSONArray |
parseJSONArray(java.io.InputStream inputStream,
java.nio.charset.Charset charset)
Construct a JSONArray from an InputStream and supplied Charset.
|
static JSONArray |
parseJSONArray(java.io.Reader reader)
Construct a JSONArray from a Reader.
|
static JSONArray |
parseJSONArray(java.lang.String s)
Construct a JSONArray from a string.
|
static JSONObject |
parseJSONObject(java.io.InputStream inputStream,
java.nio.charset.Charset charset)
Construct a JSONObject from an InputStream and supplied Charset.
|
static JSONObject |
parseJSONObject(java.io.Reader reader)
Construct a JSONObject from a Reader.
|
static JSONObject |
parseJSONObject(java.lang.String s)
Construct a JSONObject from a string.
|
static java.lang.Object |
parseJSONValue(java.io.InputStream inputStream,
java.nio.charset.Charset charset)
Construct a JSON value from an InputStream and supplied Charset.
|
static java.lang.Object |
parseJSONValue(java.io.Reader reader)
Construct a JSON value from a Reader.
|
static java.lang.Object |
parseJSONValue(java.lang.String s)
Construct a JSON value from a string.
|
pooledKey, toString
back, dehexchar, end, more, next, next, next, nextTo, nextTo, parsePosition, skipTo, syntaxError, syntaxError, syntaxError
public JSONStrictTokener(java.io.Reader reader)
reader
- A reader.public JSONStrictTokener(java.io.InputStream inputStream, java.nio.charset.Charset charset)
inputStream
- an input stream from which to tokenize the JSON textcharset
- the character set with which to interpret the input streampublic JSONStrictTokener(java.lang.String s)
s
- A source string.public char nextClean() throws JSONException
nextClean
in class JSONTokener
JSONException
- there was a problem tokenizing the JSON textpublic JSONTokener.JSONToken nextTokenType() throws JSONException
nextTokenType
in class JSONTokener
JSONException
JSONTokener.JSONToken
public java.lang.String nextString(char quote) throws JSONException
nextString
in class JSONTokener
quote
- The quoting character, must be
"
(double quote).JSONException
- Unterminated string.public java.lang.String nextKey() throws JSONException
nextKey
in class JSONTokener
JSONException
- If syntax error.public java.lang.Object nextValue() throws JSONException
nextValue
in class JSONTokener
JSONException
- If syntax error.protected JSONObject nextJSONObject()
protected JSONArray nextJSONArray()
protected java.lang.Number nextNumber()
public static JSONObject parseJSONObject(java.io.Reader reader) throws JSONException
reader
- the source readerJSONException
- there was a parse errorpublic static JSONObject parseJSONObject(java.io.InputStream inputStream, java.nio.charset.Charset charset)
inputStream
- the input stream containing the byte sequences to parsecharset
- the character set for interpreting the byte sequenceJSONException
- there was a parse errorpublic static JSONObject parseJSONObject(java.lang.String s)
s
- A source string.JSONException
- there was a parse errorpublic static JSONArray parseJSONArray(java.io.Reader reader) throws JSONException
reader
- the source readerJSONException
- there was a parse errorpublic static JSONArray parseJSONArray(java.io.InputStream inputStream, java.nio.charset.Charset charset) throws JSONException
inputStream
- the input stream containing the byte sequences to parsecharset
- the character set for interpreting the byte sequenceJSONException
- there was a parse errorpublic static JSONArray parseJSONArray(java.lang.String s) throws JSONException
s
- A source string.JSONException
- there was a parse errorpublic static java.lang.Object parseJSONValue(java.io.Reader reader) throws JSONException
reader
- the source readerJSONException
- there was a parse errorpublic static java.lang.Object parseJSONValue(java.io.InputStream inputStream, java.nio.charset.Charset charset) throws JSONException
inputStream
- the input stream containing the byte sequences to parsecharset
- the character set for interpreting the byte sequenceJSONException
- there was a parse errorpublic static java.lang.Object parseJSONValue(java.lang.String s) throws JSONException
s
- A source string.JSONException
- there was a parse error