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
-
class GsonParser extends JsonParser
Low-level JSON serializer implementation based on GSON.Implementation is not thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>currentNameStackprivate java.lang.StringcurrentTextprivate JsonTokencurrentTokenprivate GsonFactoryfactoryprivate com.google.gson.stream.JsonReaderreader
-
Constructor Summary
Constructors Constructor Description GsonParser(GsonFactory factory, com.google.gson.stream.JsonReader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckNumber()voidclose()Closes the parser and the underlying input stream or reader, and releases any memory associated with it.java.math.BigIntegergetBigIntegerValue()Returns theBigIntegervalue of the current token.bytegetByteValue()Returns the byte value of the current token.java.lang.StringgetCurrentName()Returns the most recent field name ornullfor array values or for root-level values.JsonTokengetCurrentToken()Returns the token the parser currently points to ornullfor none (at start of input or after end of input).java.math.BigDecimalgetDecimalValue()Returns theBigDecimalvalue of the current token.doublegetDoubleValue()Returns the double value of the current token.JsonFactorygetFactory()Returns the JSON factory from which this generator was created.floatgetFloatValue()Returns the float value of the current token.intgetIntValue()Returns the int value of the current token.longgetLongValue()Returns the long value of the current token.shortgetShortValue()Returns the short value of the current token.java.lang.StringgetText()Returns a textual representation of the current token ornullifJsonParser.getCurrentToken()isnull.JsonTokennextToken()Returns the next token from the stream ornullto indicate end of input.JsonParserskipChildren()Skips to the matchingJsonToken.END_ARRAYif current token isJsonToken.START_ARRAY, the matchingJsonToken.END_OBJECTif 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 Detail
-
reader
private final com.google.gson.stream.JsonReader reader
-
factory
private final GsonFactory factory
-
currentNameStack
private java.util.List<java.lang.String> currentNameStack
-
currentToken
private JsonToken currentToken
-
currentText
private java.lang.String currentText
-
-
Constructor Detail
-
GsonParser
GsonParser(GsonFactory factory, com.google.gson.stream.JsonReader reader)
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionDescription copied from class:JsonParserCloses the parser and the underlying input stream or reader, and releases any memory associated with it.- Specified by:
closein classJsonParser- Throws:
java.io.IOException
-
getCurrentName
public java.lang.String getCurrentName()
Description copied from class:JsonParserReturns the most recent field name ornullfor array values or for root-level values.- Specified by:
getCurrentNamein classJsonParser
-
getCurrentToken
public JsonToken getCurrentToken()
Description copied from class:JsonParserReturns the token the parser currently points to ornullfor none (at start of input or after end of input).- Specified by:
getCurrentTokenin classJsonParser
-
getFactory
public JsonFactory getFactory()
Description copied from class:JsonParserReturns the JSON factory from which this generator was created.- Specified by:
getFactoryin classJsonParser
-
getByteValue
public byte getByteValue()
Description copied from class:JsonParserReturns the byte value of the current token.- Specified by:
getByteValuein classJsonParser
-
getShortValue
public short getShortValue()
Description copied from class:JsonParserReturns the short value of the current token.- Specified by:
getShortValuein classJsonParser
-
getIntValue
public int getIntValue()
Description copied from class:JsonParserReturns the int value of the current token.- Specified by:
getIntValuein classJsonParser
-
getFloatValue
public float getFloatValue()
Description copied from class:JsonParserReturns the float value of the current token.- Specified by:
getFloatValuein classJsonParser
-
getBigIntegerValue
public java.math.BigInteger getBigIntegerValue()
Description copied from class:JsonParserReturns theBigIntegervalue of the current token.- Specified by:
getBigIntegerValuein classJsonParser
-
getDecimalValue
public java.math.BigDecimal getDecimalValue()
Description copied from class:JsonParserReturns theBigDecimalvalue of the current token.- Specified by:
getDecimalValuein classJsonParser
-
getDoubleValue
public double getDoubleValue()
Description copied from class:JsonParserReturns the double value of the current token.- Specified by:
getDoubleValuein classJsonParser
-
getLongValue
public long getLongValue()
Description copied from class:JsonParserReturns the long value of the current token.- Specified by:
getLongValuein classJsonParser
-
checkNumber
private void checkNumber()
-
getText
public java.lang.String getText()
Description copied from class:JsonParserReturns a textual representation of the current token ornullifJsonParser.getCurrentToken()isnull.- Specified by:
getTextin classJsonParser
-
nextToken
public JsonToken nextToken() throws java.io.IOException
Description copied from class:JsonParserReturns the next token from the stream ornullto indicate end of input.- Specified by:
nextTokenin classJsonParser- Throws:
java.io.IOException
-
skipChildren
public JsonParser skipChildren() throws java.io.IOException
Description copied from class:JsonParserSkips to the matchingJsonToken.END_ARRAYif current token isJsonToken.START_ARRAY, the matchingJsonToken.END_OBJECTif the current token isJsonToken.START_OBJECT, else does nothing.- Specified by:
skipChildrenin classJsonParser- Throws:
java.io.IOException
-
-