com.google.api.client.testing.http.json
Class MockJsonParser

java.lang.Object
  extended by com.google.api.client.json.JsonParser
      extended by com.google.api.client.testing.http.json.MockJsonParser

public class MockJsonParser
extends JsonParser

Mock for JsonParser.

Implementation is thread-safe.

Since:
1.11
Author:
[email protected] (Ravi Mistry)

Method Summary
 void close()
          Closes the parser and the underlying input stream or reader, and releases any memory associated with it.
 BigInteger getBigIntegerValue()
          Returns the BigInteger value of the current token.
 byte getByteValue()
          Returns the byte value of the current token.
 String getCurrentName()
          Returns the most recent field name or null for array values or for root-level values.
 JsonToken getCurrentToken()
          Returns the token the parser currently points to or null for none (at start of input or after end of input).
 BigDecimal getDecimalValue()
          Returns the BigDecimal value of the current token.
 double getDoubleValue()
          Returns the double value of the current token.
 JsonFactory getFactory()
          Returns the JSON factory from which this generator was created.
 float getFloatValue()
          Returns the float value of the current token.
 int getIntValue()
          Returns the int value of the current token.
 long getLongValue()
          Returns the long value of the current token.
 short getShortValue()
          Returns the short value of the current token.
 String getText()
          Returns a textual representation of the current token or null if JsonParser.getCurrentToken() is null.
 com.google.common.primitives.UnsignedInteger getUnsignedIntegerValue()
          Returns the UnsignedInteger value of the current token.
 com.google.common.primitives.UnsignedLong getUnsignedLongValue()
          Returns the UnsignedLong value of the current token.
 JsonToken nextToken()
          Returns the next token from the stream or null to indicate end of input.
 JsonParser skipChildren()
          Skips to the matching JsonToken.END_ARRAY if current token is JsonToken.START_ARRAY, the matching JsonToken.END_OBJECT if the current token is JsonToken.START_OBJECT, else does nothing.
 
Methods inherited from class com.google.api.client.json.JsonParser
parse, parse, parse, parseAndClose, parseAndClose, parseArray, parseArray, parseArrayAndClose, parseArrayAndClose, skipToKey, skipToKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactory

public JsonFactory getFactory()
Description copied from class: JsonParser
Returns the JSON factory from which this generator was created.

Specified by:
getFactory in class JsonParser

close

public void close()
           throws IOException
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 class JsonParser
Throws:
IOException - if failed

nextToken

public JsonToken nextToken()
                    throws IOException
Description copied from class: JsonParser
Returns the next token from the stream or null to indicate end of input.

Specified by:
nextToken in class JsonParser
Throws:
IOException

getCurrentToken

public JsonToken getCurrentToken()
Description copied from class: JsonParser
Returns the token the parser currently points to or null for none (at start of input or after end of input).

Specified by:
getCurrentToken in class JsonParser

getCurrentName

public String getCurrentName()
                      throws IOException
Description copied from class: JsonParser
Returns the most recent field name or null for array values or for root-level values.

Specified by:
getCurrentName in class JsonParser
Throws:
IOException

skipChildren

public JsonParser skipChildren()
                        throws IOException
Description copied from class: JsonParser
Skips to the matching JsonToken.END_ARRAY if current token is JsonToken.START_ARRAY, the matching JsonToken.END_OBJECT if the current token is JsonToken.START_OBJECT, else does nothing.

Specified by:
skipChildren in class JsonParser
Throws:
IOException

getText

public String getText()
               throws IOException
Description copied from class: JsonParser
Returns a textual representation of the current token or null if JsonParser.getCurrentToken() is null.

Specified by:
getText in class JsonParser
Throws:
IOException

getByteValue

public byte getByteValue()
                  throws IOException
Description copied from class: JsonParser
Returns the byte value of the current token.

Specified by:
getByteValue in class JsonParser
Throws:
IOException

getShortValue

public short getShortValue()
                    throws IOException
Description copied from class: JsonParser
Returns the short value of the current token.

Specified by:
getShortValue in class JsonParser
Throws:
IOException

getIntValue

public int getIntValue()
                throws IOException
Description copied from class: JsonParser
Returns the int value of the current token.

Specified by:
getIntValue in class JsonParser
Throws:
IOException

getFloatValue

public float getFloatValue()
                    throws IOException
Description copied from class: JsonParser
Returns the float value of the current token.

Specified by:
getFloatValue in class JsonParser
Throws:
IOException

getLongValue

public long getLongValue()
                  throws IOException
Description copied from class: JsonParser
Returns the long value of the current token.

Specified by:
getLongValue in class JsonParser
Throws:
IOException

getDoubleValue

public double getDoubleValue()
                      throws IOException
Description copied from class: JsonParser
Returns the double value of the current token.

Specified by:
getDoubleValue in class JsonParser
Throws:
IOException

getBigIntegerValue

public BigInteger getBigIntegerValue()
                              throws IOException
Description copied from class: JsonParser
Returns the BigInteger value of the current token.

Specified by:
getBigIntegerValue in class JsonParser
Throws:
IOException

getUnsignedIntegerValue

public com.google.common.primitives.UnsignedInteger getUnsignedIntegerValue()
                                                                     throws IOException
Description copied from class: JsonParser
Returns the UnsignedInteger value of the current token.

Specified by:
getUnsignedIntegerValue in class JsonParser
Throws:
IOException

getUnsignedLongValue

public com.google.common.primitives.UnsignedLong getUnsignedLongValue()
                                                               throws IOException
Description copied from class: JsonParser
Returns the UnsignedLong value of the current token.

Specified by:
getUnsignedLongValue in class JsonParser
Throws:
IOException

getDecimalValue

public BigDecimal getDecimalValue()
                           throws IOException
Description copied from class: JsonParser
Returns the BigDecimal value of the current token.

Specified by:
getDecimalValue in class JsonParser
Throws:
IOException


Copyright © 2011-2012 Google. All Rights Reserved.