Class JsonReader
java.lang.Object
org.apache.logging.log4j.layout.template.json.util.JsonReader
A simple JSON parser mapping tokens to basic Java types.
The type mapping is as follows:
- objects are mapped to
LinkedHashMap<String,Object> - arrays are mapped to
LinkedList - strings are mapped to
Stringwith proper Unicode and escape character conversion - true, false, and null are mapped to their Java counterparts
- floating point numbers are mapped to
BigDecimal - integral numbers are mapped to either primitive types
(int, long) or
BigInteger
This code is heavily influenced by the reader of mjson.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilderprivate CharacterIteratorprivate charprivate intprivate Objectprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbufferChar(char c) private voidprivate voidprivate voidexpectDelimiter(JsonReader.Delimiter expectedDelimiter, Object actualToken) static Objectprivate Objectprivate charreadChar()private booleanprivate ObjectreadNull()private Numberprivate Stringprivate Stringprivate Objectprivate booleanreadTrue()private charprivate voidprivate void
-
Field Details
-
it
-
readCharIndex
private int readCharIndex -
readChar
private char readChar -
readTokenStartIndex
private int readTokenStartIndex -
readToken
-
buffer
-
-
Constructor Details
-
JsonReader
private JsonReader()
-
-
Method Details
-
read
-
read
-
readToken
-
skipWhiteSpace
private void skipWhiteSpace() -
readChar
private char readChar() -
unreadChar
private void unreadChar() -
readString
-
bufferReadChar
private void bufferReadChar() -
bufferChar
private void bufferChar(char c) -
readUnicodeChar
private char readUnicodeChar() -
readObject
-
readArray
-
readObjectKey
-
expectDelimiter
-
readTrue
private boolean readTrue() -
readFalse
private boolean readFalse() -
readNull
-
readNumber
-
bufferDigits
private void bufferDigits()
-