Package com.google.api.client.json.gson
Class GsonParser
java.lang.Object
com.google.api.client.json.JsonParser
com.google.api.client.json.gson.GsonParser
Low-level JSON serializer implementation based on GSON.
Implementation is not thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private JsonToken
private final GsonFactory
private final com.google.gson.stream.JsonReader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
void
close()
Closes the parser and the underlying input stream or reader, and releases any memory associated with it.Returns theBigInteger
value of the current token.byte
Returns the byte value of the current token.Returns the most recent field name ornull
for array values or for root-level values.Returns the token the parser currently points to ornull
for none (at start of input or after end of input).Returns theBigDecimal
value of the current token.double
Returns the double value of the current token.Returns the JSON factory from which this generator was created.float
Returns the float value of the current token.int
Returns the int value of the current token.long
Returns the long value of the current token.short
Returns the short value of the current token.getText()
Returns a textual representation of the current token ornull
ifJsonParser.getCurrentToken()
isnull
.Returns the next token from the stream ornull
to indicate end of input.Skips to the matchingJsonToken.END_ARRAY
if current token isJsonToken.START_ARRAY
, the matchingJsonToken.END_OBJECT
if the current token isJsonToken.START_OBJECT
, else does nothing.Methods inherited from class com.google.api.client.json.JsonParser
parse, parse, parse, parse, parse, parse, parseAndClose, parseAndClose, parseAndClose, parseAndClose, parseArray, parseArray, parseArray, parseArray, parseArrayAndClose, parseArrayAndClose, parseArrayAndClose, parseArrayAndClose, skipToKey, skipToKey
-
Field Details
-
reader
private final com.google.gson.stream.JsonReader reader -
factory
-
currentNameStack
-
currentToken
-
currentText
-
-
Constructor Details
-
GsonParser
GsonParser(GsonFactory factory, com.google.gson.stream.JsonReader reader)
-
-
Method Details
-
close
Description copied from class:JsonParser
Closes the parser and the underlying input stream or reader, and releases any memory associated with it.- Specified by:
close
in classJsonParser
- Throws:
IOException
-
getCurrentName
Description copied from class:JsonParser
Returns the most recent field name ornull
for array values or for root-level values.- Specified by:
getCurrentName
in classJsonParser
-
getCurrentToken
Description copied from class:JsonParser
Returns the token the parser currently points to ornull
for none (at start of input or after end of input).- Specified by:
getCurrentToken
in classJsonParser
-
getFactory
Description copied from class:JsonParser
Returns the JSON factory from which this generator was created.- Specified by:
getFactory
in classJsonParser
-
getByteValue
public byte getByteValue()Description copied from class:JsonParser
Returns the byte value of the current token.- Specified by:
getByteValue
in classJsonParser
-
getShortValue
public short getShortValue()Description copied from class:JsonParser
Returns the short value of the current token.- Specified by:
getShortValue
in classJsonParser
-
getIntValue
public int getIntValue()Description copied from class:JsonParser
Returns the int value of the current token.- Specified by:
getIntValue
in classJsonParser
-
getFloatValue
public float getFloatValue()Description copied from class:JsonParser
Returns the float value of the current token.- Specified by:
getFloatValue
in classJsonParser
-
getBigIntegerValue
Description copied from class:JsonParser
Returns theBigInteger
value of the current token.- Specified by:
getBigIntegerValue
in classJsonParser
-
getDecimalValue
Description copied from class:JsonParser
Returns theBigDecimal
value of the current token.- Specified by:
getDecimalValue
in classJsonParser
-
getDoubleValue
public double getDoubleValue()Description copied from class:JsonParser
Returns the double value of the current token.- Specified by:
getDoubleValue
in classJsonParser
-
getLongValue
public long getLongValue()Description copied from class:JsonParser
Returns the long value of the current token.- Specified by:
getLongValue
in classJsonParser
-
checkNumber
private void checkNumber() -
getText
Description copied from class:JsonParser
Returns a textual representation of the current token ornull
ifJsonParser.getCurrentToken()
isnull
.- Specified by:
getText
in classJsonParser
-
nextToken
Description copied from class:JsonParser
Returns the next token from the stream ornull
to indicate end of input.- Specified by:
nextToken
in classJsonParser
- Throws:
IOException
-
skipChildren
Description copied from class:JsonParser
Skips to the matchingJsonToken.END_ARRAY
if current token isJsonToken.START_ARRAY
, the matchingJsonToken.END_OBJECT
if the current token isJsonToken.START_OBJECT
, else does nothing.- Specified by:
skipChildren
in classJsonParser
- Throws:
IOException
-