Package org.h2.util.json
Class JSONStringSource
- java.lang.Object
-
- org.h2.util.json.JSONTextSource
-
- org.h2.util.json.JSONStringSource
-
public final class JSONStringSource extends JSONTextSource
JSON string source.
-
-
Field Summary
Fields Modifier and Type Field Description private intindexprivate intlengthprivate java.lang.Stringstring-
Fields inherited from class org.h2.util.json.JSONTextSource
target
-
-
Constructor Summary
Constructors Constructor Description JSONStringSource(java.lang.String string, JSONTarget<?> target)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intnextChar()Read the next character.(package private) intnextCharAfterWhitespace()Skip all whitespace characters, and get the next character.static byte[]normalize(java.lang.String string)Normalizes textual JSON representation.static <R> Rparse(java.lang.String string, JSONTarget<R> target)Parses source string to a specified target.(package private) voidparseNumber(boolean positive)Parse a number.(package private) charreadHex()Read 4 hex characters (0-9, a-f, A-F), and return the Unicode character.(package private) voidreadKeyword1(java.lang.String keyword)Read the specified keyword, or (it there is no match), throw an IllegalArgumentException.private intskipInt(int index, boolean hasInt)java.lang.StringtoString()-
Methods inherited from class org.h2.util.json.JSONTextSource
parse
-
-
-
-
Constructor Detail
-
JSONStringSource
JSONStringSource(java.lang.String string, JSONTarget<?> target)
-
-
Method Detail
-
parse
public static <R> R parse(java.lang.String string, JSONTarget<R> target)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
public static byte[] normalize(java.lang.String string)
Normalizes textual JSON representation.- Parameters:
string- source representation- Returns:
- normalized representation
-
nextCharAfterWhitespace
int nextCharAfterWhitespace()
Description copied from class:JSONTextSourceSkip all whitespace characters, and get the next character.- Specified by:
nextCharAfterWhitespacein classJSONTextSource- Returns:
- the character code
-
readKeyword1
void readKeyword1(java.lang.String keyword)
Description copied from class:JSONTextSourceRead the specified keyword, or (it there is no match), throw an IllegalArgumentException.- Specified by:
readKeyword1in classJSONTextSource- Parameters:
keyword- the expected keyword
-
parseNumber
void parseNumber(boolean positive)
Description copied from class:JSONTextSourceParse a number.- Specified by:
parseNumberin classJSONTextSource- Parameters:
positive- whether it needs to be positive
-
skipInt
private int skipInt(int index, boolean hasInt)
-
nextChar
int nextChar()
Description copied from class:JSONTextSourceRead the next character.- Specified by:
nextCharin classJSONTextSource- Returns:
- the character code
-
readHex
char readHex()
Description copied from class:JSONTextSourceRead 4 hex characters (0-9, a-f, A-F), and return the Unicode character.- Specified by:
readHexin classJSONTextSource- Returns:
- the character
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-