Class MockJsonParser
- java.lang.Object
-
- com.google.api.client.json.JsonParser
-
- com.google.api.client.testing.json.MockJsonParser
-
@Beta public class MockJsonParser extends JsonParser
- Since:
- 1.15 (since 1.11 as com.google.api.client.testing.http.json.MockJsonParser)
- Author:
- rmistry@google.com (Ravi Mistry)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the parser and the underlying input stream or reader, and releases any memory associated with it.BigIntegergetBigIntegerValue()Returns theBigIntegervalue of the current token.bytegetByteValue()Returns the byte value of the current token.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).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.StringgetText()Returns a textual representation of the current token ornullifJsonParser.getCurrentToken()isnull.booleanisClosed()Returns whetherclose()was called.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
-
-
-
-
Method Detail
-
getFactory
public JsonFactory getFactory()
Description copied from class:JsonParserReturns the JSON factory from which this generator was created.- Specified by:
getFactoryin classJsonParser
-
close
public void close() throws 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:
IOException
-
nextToken
public JsonToken nextToken() throws IOException
Description copied from class:JsonParserReturns the next token from the stream ornullto indicate end of input.- Specified by:
nextTokenin classJsonParser- Throws:
IOException
-
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
-
getCurrentName
public String getCurrentName() throws IOException
Description copied from class:JsonParserReturns the most recent field name ornullfor array values or for root-level values.- Specified by:
getCurrentNamein classJsonParser- Throws:
IOException
-
skipChildren
public JsonParser skipChildren() throws 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:
IOException
-
getText
public String getText() throws IOException
Description copied from class:JsonParserReturns a textual representation of the current token ornullifJsonParser.getCurrentToken()isnull.- Specified by:
getTextin classJsonParser- Throws:
IOException
-
getByteValue
public byte getByteValue() throws IOExceptionDescription copied from class:JsonParserReturns the byte value of the current token.- Specified by:
getByteValuein classJsonParser- Throws:
IOException
-
getShortValue
public short getShortValue() throws IOExceptionDescription copied from class:JsonParserReturns the short value of the current token.- Specified by:
getShortValuein classJsonParser- Throws:
IOException
-
getIntValue
public int getIntValue() throws IOExceptionDescription copied from class:JsonParserReturns the int value of the current token.- Specified by:
getIntValuein classJsonParser- Throws:
IOException
-
getFloatValue
public float getFloatValue() throws IOExceptionDescription copied from class:JsonParserReturns the float value of the current token.- Specified by:
getFloatValuein classJsonParser- Throws:
IOException
-
getLongValue
public long getLongValue() throws IOExceptionDescription copied from class:JsonParserReturns the long value of the current token.- Specified by:
getLongValuein classJsonParser- Throws:
IOException
-
getDoubleValue
public double getDoubleValue() throws IOExceptionDescription copied from class:JsonParserReturns the double value of the current token.- Specified by:
getDoubleValuein classJsonParser- Throws:
IOException
-
getBigIntegerValue
public BigInteger getBigIntegerValue() throws IOException
Description copied from class:JsonParserReturns theBigIntegervalue of the current token.- Specified by:
getBigIntegerValuein classJsonParser- Throws:
IOException
-
getDecimalValue
public BigDecimal getDecimalValue() throws IOException
Description copied from class:JsonParserReturns theBigDecimalvalue of the current token.- Specified by:
getDecimalValuein classJsonParser- Throws:
IOException
-
isClosed
public boolean isClosed()
Returns whetherclose()was called.- Since:
- 1.15
-
-