Package org.apache.tomcat.util.json
Class JSONParser
java.lang.Object
org.apache.tomcat.util.json.JSONParser
- All Implemented Interfaces:
JSONParserConstants
Basic JSON parser generated by JavaCC. It consumes the input provided through the constructor when
parseObject()
, parseList()
, or parse()
are called, and there is no way to directly
reset the state.-
Field Summary
Modifier and TypeFieldDescriptionNext token.Current token.Generated Token Manager.Fields inherited from interface org.apache.tomcat.util.json.JSONParserConstants
BRACE_CLOSE, BRACE_OPEN, BRACKET_CLOSE, BRACKET_OPEN, C_MULTILINE_COMMENT, C_SINGLE_COMMENT, COLON, COMMA, DEFAULT, DIGIT, DIGIT_NONZERO, EOF, EOL, FALSE, NULL, NUMBER_DECIMAL, NUMBER_INTEGER, QUOTE_DOUBLE, QUOTE_SINGLE, SH_SINGLE_COMMENT, STRING_DOUBLE_BODY, STRING_DOUBLE_EMPTY, STRING_DOUBLE_NONEMPTY, STRING_SINGLE_BODY, STRING_SINGLE_EMPTY, STRING_SINGLE_NONEMPTY, SYMBOL, tokenImage, TRUE, WHITESPACE, ZERO
-
Constructor Summary
ConstructorDescriptionJSONParser
(InputStream stream) Constructor with InputStream.JSONParser
(InputStream stream, String encoding) Constructor with InputStream and supplied encodingJSONParser
(Reader stream) Constructor.JSONParser
(String input) Constructor with generated Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal Object
anything()
final Boolean
final void
Disable tracing.final String
final void
Enable tracing.final boolean
Generate ParseException.boolean
final Token
Get the next Token.final Token
getToken
(int index) Get the specific Token.list()
final Object
final Number
number()
final LinkedHashMap<String,
Object> object()
final String
parse()
Parses any JSON-parseable object, returning the value.Parses a JSON array into a JavaList
.Parses a JSON object into a JavaMap
.void
ReInit
(InputStream stream) Reinitialise.void
ReInit
(InputStream stream, String encoding) Reinitialise.void
Reinitialise.void
Reinitialise.void
setNativeNumbers
(boolean value) final String
final String
string()
final String
symbol()
final boolean
Trace enabled.final Object
value()
-
Field Details
-
token_source
Generated Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
JSONParser
-
JSONParser
Constructor with InputStream. -
JSONParser
Constructor with InputStream and supplied encoding -
JSONParser
Constructor. -
JSONParser
Constructor with generated Token Manager.
-
-
Method Details
-
parseObject
Parses a JSON object into a JavaMap
.- Throws:
ParseException
-
parseArray
Parses a JSON array into a JavaList
.- Throws:
ParseException
-
parse
Parses any JSON-parseable object, returning the value.- Throws:
ParseException
-
setNativeNumbers
public void setNativeNumbers(boolean value) -
getNativeNumbers
public boolean getNativeNumbers() -
ensureEOF
- Throws:
ParseException
-
anything
- Throws:
ParseException
-
objectKey
- Throws:
ParseException
-
object
- Throws:
ParseException
-
list
- Throws:
ParseException
-
value
- Throws:
ParseException
-
nullValue
- Throws:
ParseException
-
booleanValue
- Throws:
ParseException
-
number
- Throws:
ParseException
-
string
- Throws:
ParseException
-
doubleQuoteString
- Throws:
ParseException
-
singleQuoteString
- Throws:
ParseException
-
symbol
- Throws:
ParseException
-
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
trace_enabled
public final boolean trace_enabled()Trace enabled. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-