Package org.h2.util.json
Class JSONStringSource
java.lang.Object
org.h2.util.json.JSONTextSource
org.h2.util.json.JSONStringSource
JSON string source.
-
Field Summary
FieldsFields inherited from class org.h2.util.json.JSONTextSource
target
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) int
nextChar()
Read the next character.(package private) int
Skip all whitespace characters, and get the next character.static byte[]
Normalizes textual JSON representation.static <R> R
parse
(String string, JSONTarget<R> target) Parses source string to a specified target.(package private) void
parseNumber
(boolean positive) Parse a number.(package private) char
readHex()
Read 4 hex characters (0-9, a-f, A-F), and return the Unicode character.(package private) void
readKeyword1
(String keyword) Read the specified keyword, or (it there is no match), throw an IllegalArgumentException.private int
skipInt
(int index, boolean hasInt) toString()
Methods inherited from class org.h2.util.json.JSONTextSource
parse
-
Field Details
-
string
-
length
private final int length -
index
private int index
-
-
Constructor Details
-
JSONStringSource
JSONStringSource(String string, JSONTarget<?> target)
-
-
Method Details
-
parse
Parses source string to a specified target.- Type Parameters:
R
- the type of the result- Parameters:
string
- sourcetarget
- target- Returns:
- the result of the target
-
normalize
Normalizes textual JSON representation.- Parameters:
string
- source representation- Returns:
- normalized representation
-
nextCharAfterWhitespace
int nextCharAfterWhitespace()Description copied from class:JSONTextSource
Skip all whitespace characters, and get the next character.- Specified by:
nextCharAfterWhitespace
in classJSONTextSource
- Returns:
- the character code
-
readKeyword1
Description copied from class:JSONTextSource
Read the specified keyword, or (it there is no match), throw an IllegalArgumentException.- Specified by:
readKeyword1
in classJSONTextSource
- Parameters:
keyword
- the expected keyword
-
parseNumber
void parseNumber(boolean positive) Description copied from class:JSONTextSource
Parse a number.- Specified by:
parseNumber
in classJSONTextSource
- Parameters:
positive
- whether it needs to be positive
-
skipInt
private int skipInt(int index, boolean hasInt) -
nextChar
int nextChar()Description copied from class:JSONTextSource
Read the next character.- Specified by:
nextChar
in classJSONTextSource
- Returns:
- the character code
-
readHex
char readHex()Description copied from class:JSONTextSource
Read 4 hex characters (0-9, a-f, A-F), and return the Unicode character.- Specified by:
readHex
in classJSONTextSource
- Returns:
- the character
-
toString
-