public abstract class BaseJsonParser
extends Object
implements JsonParser
Base JSON parser. Scaled down version of Boon JsonParser with features removed that are JDK 1.7 dependent or Groovy duplicated functionality.
| Modifiers | Name | Description |
|---|---|---|
protected static int |
ALPHA_0 |
Character code for digit 0. |
protected static int |
ALPHA_1 |
Character code for digit 1. |
protected static int |
ALPHA_2 |
Character code for digit 2. |
protected static int |
ALPHA_3 |
Character code for digit 3. |
protected static int |
ALPHA_4 |
Character code for digit 4. |
protected static int |
ALPHA_5 |
Character code for digit 5. |
protected static int |
ALPHA_6 |
Character code for digit 6. |
protected static int |
ALPHA_7 |
Character code for digit 7. |
protected static int |
ALPHA_8 |
Character code for digit 8. |
protected static int |
ALPHA_9 |
Character code for digit 9. |
protected static int |
CLOSED_BRACKET |
Character code for the closing array delimiter ]. |
protected static int |
CLOSED_CURLY |
Character code for the closing object delimiter }. |
protected static int |
COLON |
Character code for the : name/value separator. |
protected static int |
COMMA |
Character code for the , element separator. |
protected static int |
DECIMAL_POINT |
Character code for the decimal point in number literals. |
protected static int |
DOUBLE_QUOTE |
Character code for the JSON string delimiter ". |
protected static int |
ESCAPE |
Character code for the JSON escape marker \. |
protected static int |
LETTER_BIG_E |
Uppercase exponent marker used in JSON numbers. |
protected static int |
LETTER_E |
Lowercase exponent marker used in JSON numbers. |
protected static int |
MINUS |
Character code for the minus sign in number literals. |
protected static int |
PLUS |
Character code for the plus sign in exponent literals. |
protected int |
bufSize |
Initial buffer size used when reading character streams. |
protected String |
charset |
Charset used for byte-based input when no override is supplied. |
protected static boolean |
internKeys |
Whether parsed object keys should be interned. |
protected static ConcurrentHashMap<String, String> |
internedKeysCache |
Cache used when key interning is enabled. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected String |
charDescription(int c)Builds a readable description of a character code for parser errors. |
|
protected static int |
findEndQuote(char[] array, int index)Finds the closing quote of a JSON string while honoring escapes. |
|
protected static boolean |
hasEscapeChar(char[] array, int index, int[] indexHolder)Scans a string body until it finds an escape or the closing quote. |
|
protected static boolean |
isDecimalChar(int currentChar)Checks whether a character can appear in a decimal JSON number. |
|
protected static boolean |
isDelimiter(int c)Checks whether a character terminates the current JSON value. |
|
protected static final boolean |
isDoubleQuote(int c)Checks whether a character code is a double quote. |
|
protected static final boolean |
isEscape(int c)Checks whether a character code is the JSON escape marker. |
|
protected static final boolean |
isNumberDigit(int c)Checks whether a character code is an ASCII digit. |
|
public Object |
parse(String jsonString)Parses a JSON string. |
|
public Object |
parse(byte[] bytes)Parses JSON bytes using the parser's configured charset. |
|
public Object |
parse(byte[] bytes, String charset)Parses JSON bytes using the supplied charset. |
|
public Object |
parse(CharSequence charSequence)Parses JSON from a character sequence. |
|
public Object |
parse(Reader reader)Parses JSON from a reader. |
|
public Object |
parse(InputStream input)Parses JSON from a byte stream using the configured charset. |
|
public Object |
parse(InputStream input, String charset)Parses JSON from a byte stream using the supplied charset. |
|
public Object |
parse(File file, String charset)Parses JSON from a file. |
|
public void |
setCharset(String charset)Sets the default charset used for byte and stream input. |
Character code for digit 0.
Character code for digit 1.
Character code for digit 2.
Character code for digit 3.
Character code for digit 4.
Character code for digit 5.
Character code for digit 6.
Character code for digit 7.
Character code for digit 8.
Character code for digit 9.
Character code for the closing array delimiter ].
Character code for the closing object delimiter }.
Character code for the : name/value separator.
Character code for the , element separator.
Character code for the decimal point in number literals.
Character code for the JSON string delimiter ".
Character code for the JSON escape marker \.
Uppercase exponent marker used in JSON numbers.
Lowercase exponent marker used in JSON numbers.
Character code for the minus sign in number literals.
Character code for the plus sign in exponent literals.
Initial buffer size used when reading character streams.
Charset used for byte-based input when no override is supplied.
Whether parsed object keys should be interned.
Cache used when key interning is enabled.
Builds a readable description of a character code for parser errors.
c - character code to describecFinds the closing quote of a JSON string while honoring escapes.
array - source bufferindex - index at which to start scanningScans a string body until it finds an escape or the closing quote.
array - source bufferindex - index at which to start scanningindexHolder - single-item holder updated with the stop indextrue when an escape character is encountered before the closing quoteChecks whether a character can appear in a decimal JSON number.
currentChar - character code to testtrue for decimal-number markersChecks whether a character terminates the current JSON value.
c - character code to testtrue when c is a value delimiterChecks whether a character code is a double quote.
c - character code to testtrue when c is "Checks whether a character code is the JSON escape marker.
c - character code to testtrue when c is \Checks whether a character code is an ASCII digit.
c - character code to testtrue when c is between 0 and 9Parses a JSON string.
jsonString - JSON text to parseParses JSON bytes using the parser's configured charset.
bytes - JSON bytes to parseParses JSON bytes using the supplied charset.
bytes - JSON bytes to parsecharset - charset name to useParses JSON from a character sequence.
charSequence - JSON text to parseParses JSON from a reader.
reader - reader supplying JSON contentParses JSON from a byte stream using the configured charset.
input - input stream supplying JSON bytesParses JSON from a byte stream using the supplied charset.
input - input stream supplying JSON bytescharset - charset name to useParses JSON from a file.
file - file containing JSON contentcharset - charset name to use, or the platform default when blankSets the default charset used for byte and stream input.
charset - charset name to use for subsequent parsing