public class CharScanner
extends Object
Low-level character scanning utilities used while parsing JSON values.
| Modifiers | Name | Description |
|---|---|---|
protected static int |
ALPHA_0 |
Character code for '0'. |
protected static int |
ALPHA_9 |
Character code for '9'. |
protected static int |
CLOSED_BRACKET |
Closing bracket character code. |
protected static int |
CLOSED_CURLY |
Closing curly brace character code. |
protected static int |
COMMA |
Comma character code. |
protected static int |
DECIMAL_POINT |
Decimal point character code. |
protected static int |
LETTER_BIG_E |
Uppercase exponent marker. |
protected static int |
LETTER_E |
Lowercase exponent marker. |
protected static int |
MINUS |
Minus sign character code. |
protected static int |
PLUS |
Plus sign character code. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static String |
debugCharDescription(int c)Returns a debug string for a character code. |
|
public static String |
errorDetails(String message, char[] array, int index, int ch)Builds a human-readable parse error description for the current character position. |
|
public static boolean |
hasDecimalChar(char[] chars, boolean negative)Tests whether a character range contains decimal punctuation. |
|
public static boolean |
isDecimalChar(int currentChar)Tests whether the supplied code point is decimal punctuation. |
|
public static boolean |
isDecimalDigit(int c)Tests whether the supplied code point can appear in a decimal number. |
|
protected static boolean |
isDelimiter(int c)Tests whether the supplied code point terminates a JSON number token. |
|
public static boolean |
isDigit(int c)Tests whether the supplied code point is an ASCII digit. |
|
public static boolean |
isInteger(char[] digitChars)Tests whether the supplied digits fit in an int. |
|
public static boolean |
isInteger(char[] digitChars, int offset, int len)Tests whether the supplied digit range fits in an int. |
|
public static boolean |
isLong(char[] digitChars)Tests whether the supplied digits fit in a long. |
|
public static boolean |
isLong(char[] digitChars, int offset, int len)Tests whether the supplied digit range fits in a long. |
|
public static boolean |
isNumberDigit(int c)Tests whether the supplied code point is a numeric digit. |
|
public static BigDecimal |
parseBigDecimal(char[] buffer)Parses a BigDecimal from the supplied characters. |
|
public static double |
parseDouble(char[] buffer, int from, int to)Parses a double from a character range. |
|
public static float |
parseFloat(char[] buffer, int from, int to)Parses a float from a character range. |
|
public static int |
parseInt(char[] digitChars)Parses an int from the supplied digit characters. |
|
public static int |
parseIntFromTo(char[] digitChars, int offset, int to)Parses an int from a character range. |
|
public static int |
parseIntFromToIgnoreDot(char[] digitChars, int offset, int to)Parses an int from a character range while ignoring decimal points. |
|
public static Number |
parseJsonNumber(char[] buffer)Parses a JSON number from the supplied character array. |
|
public static Number |
parseJsonNumber(char[] buffer, int from, int to)Parses a JSON number from a character range. |
|
public static Number |
parseJsonNumber(char[] buffer, int from, int max, int[] size)Parses a JSON number and optionally reports the stopping index. |
|
public static long |
parseLong(char[] digitChars)Parses a long from the supplied digit characters. |
|
public static long |
parseLongFromTo(char[] digitChars, int offset, int to)Parses a long from a character range. |
|
public static long |
parseLongFromToIgnoreDot(char[] digitChars, int offset, int to)Parses a long from a character range while ignoring decimal points. |
|
public static char[] |
readNumber(char[] array, int idx, int len)Copies a contiguous JSON number token into a new array. |
|
public static int |
skipWhiteSpace(char[] array, int index, int length)Advances past ASCII whitespace. |
Character code for '0'.
Character code for '9'.
Closing bracket character code.
Closing curly brace character code.
Comma character code.
Decimal point character code.
Uppercase exponent marker.
Lowercase exponent marker.
Minus sign character code.
Plus sign character code.
Returns a debug string for a character code.
c - the character code to describeBuilds a human-readable parse error description for the current character position.
message - the high-level error messagearray - the source character arrayindex - the failing indexch - the current character codeTests whether a character range contains decimal punctuation.
chars - the character array to inspectnegative - whether the first character is a sign and should be skippedtrue if a decimal marker or exponent marker is presentTests whether the supplied code point is decimal punctuation.
currentChar - the character code to testtrue for sign, exponent, or decimal point charactersTests whether the supplied code point can appear in a decimal number.
c - the character code to testtrue for digits and decimal punctuationTests whether the supplied code point terminates a JSON number token.
c - the character code to testtrue if the code point is a structural delimiterTests whether the supplied code point is an ASCII digit.
c - the character code to testtrue if the code point is between '0' and '9' Tests whether the supplied digits fit in an int.
digitChars - the digit characters to testtrue if the value is within the int range Tests whether the supplied digit range fits in an int.
digitChars - the digit characters to testoffset - the inclusive range startlen - the number of characters to comparetrue if the value is within the int range Tests whether the supplied digits fit in a long.
digitChars - the digit characters to testtrue if the value is within the long range Tests whether the supplied digit range fits in a long.
digitChars - the digit characters to testoffset - the inclusive range startlen - the number of characters to comparetrue if the value is within the long rangeTests whether the supplied code point is a numeric digit.
c - the character code to testtrue if the code point is between '0' and '9'Parses a BigDecimal from the supplied characters.
buffer - the character array to parse Parses a double from a character range.
buffer - the character array to parsefrom - the inclusive range startto - the exclusive range end Parses a float from a character range.
buffer - the character array to parsefrom - the inclusive range startto - the exclusive range end Parses an int from the supplied digit characters.
digitChars - the digit characters to parse Parses an int from a character range.
digitChars - the digit characters to parseoffset - the inclusive range startto - the exclusive range end Parses an int from a character range while ignoring decimal points.
digitChars - the digit characters to parseoffset - the inclusive range startto - the exclusive range endParses a JSON number from the supplied character array.
buffer - the character array containing the numberParses a JSON number from a character range.
buffer - the character array containing the numberfrom - the inclusive range startto - the exclusive range endParses a JSON number and optionally reports the stopping index.
buffer - the character array containing the numberfrom - the inclusive range startmax - the exclusive scan limitsize - optional single-element output array receiving the stopping index Parses a long from the supplied digit characters.
digitChars - the digit characters to parse Parses a long from a character range.
digitChars - the digit characters to parseoffset - the inclusive range startto - the exclusive range end Parses a long from a character range while ignoring decimal points.
digitChars - the digit characters to parseoffset - the inclusive range startto - the exclusive range endCopies a contiguous JSON number token into a new array.
array - the source character arrayidx - the index at which the number startslen - the exclusive scan limitAdvances past ASCII whitespace.
array - the character array to scanindex - the index to start fromlength - the exclusive scan limitlength