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
FieldsModifier 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
ConstructorsConstructorDescriptionJSONParser(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 Objectanything()final Booleanfinal voidDisable tracing.final Stringfinal voidEnable tracing.final booleanGenerate ParseException.booleanfinal TokenGet the next Token.final TokengetToken(int index) Get the specific Token.list()final Objectfinal Numbernumber()final LinkedHashMap<String,Object> object()final Stringparse()Parses any JSON-parseable object, returning the value.Parses a JSON array into a JavaList.Parses a JSON object into a JavaMap.voidReInit(InputStream stream) Reinitialise.voidReInit(InputStream stream, String encoding) Reinitialise.voidReinitialise.voidReinitialise.voidsetNativeNumbers(boolean value) final Stringfinal Stringstring()final Stringsymbol()final booleanTrace enabled.final Objectvalue()
-
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.
-