Class MockJsonGenerator
- java.lang.Object
-
- com.google.api.client.json.JsonGenerator
-
- com.google.api.client.testing.json.MockJsonGenerator
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
@Beta public class MockJsonGenerator extends JsonGenerator
- Since:
- 1.15 (since 1.11 as com.google.api.client.testing.http.json.MockJsonGenerator)
-
-
Field Summary
Fields Modifier and Type Field Description private JsonFactoryfactory
-
Constructor Summary
Constructors Constructor Description MockJsonGenerator(JsonFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the serializer and the underlying output stream or writer, and releases any memory associated with it.voidflush()Flushes any buffered content to the underlying output stream or writer.JsonFactorygetFactory()Returns the JSON factory from which this generator was created.voidwriteBoolean(boolean state)Writes a literal JSON boolean value ('true' or 'false').voidwriteEndArray()Writes a JSON end array character ']'.voidwriteEndObject()Writes a JSON end object character '}'.voidwriteFieldName(java.lang.String name)Writes a JSON quoted field name.voidwriteNull()Writes a literal JSON null value.voidwriteNumber(double v)Writes a JSON double value.voidwriteNumber(float v)Writes a JSON float value.voidwriteNumber(int v)Writes a JSON int value.voidwriteNumber(long v)Writes a JSON long value.voidwriteNumber(java.lang.String encodedValue)Writes a JSON numeric value that has already been encoded properly.voidwriteNumber(java.math.BigDecimal v)Writes a JSON big decimal value.voidwriteNumber(java.math.BigInteger v)Writes a JSON big integer value.voidwriteStartArray()Writes a JSON start array character '['.voidwriteStartObject()Writes a JSON start object character '{'.voidwriteString(java.lang.String value)Writes a JSON quoted string value.-
Methods inherited from class com.google.api.client.json.JsonGenerator
enablePrettyPrint, serialize
-
-
-
-
Field Detail
-
factory
private final JsonFactory factory
-
-
Constructor Detail
-
MockJsonGenerator
MockJsonGenerator(JsonFactory factory)
-
-
Method Detail
-
getFactory
public JsonFactory getFactory()
Description copied from class:JsonGeneratorReturns the JSON factory from which this generator was created.- Specified by:
getFactoryin classJsonGenerator
-
flush
public void flush() throws java.io.IOExceptionDescription copied from class:JsonGeneratorFlushes any buffered content to the underlying output stream or writer.- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classJsonGenerator- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionDescription copied from class:JsonGeneratorCloses the serializer and the underlying output stream or writer, and releases any memory associated with it.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classJsonGenerator- Throws:
java.io.IOException
-
writeStartArray
public void writeStartArray() throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON start array character '['.- Specified by:
writeStartArrayin classJsonGenerator- Throws:
java.io.IOException
-
writeEndArray
public void writeEndArray() throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON end array character ']'.- Specified by:
writeEndArrayin classJsonGenerator- Throws:
java.io.IOException
-
writeStartObject
public void writeStartObject() throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON start object character '{'.- Specified by:
writeStartObjectin classJsonGenerator- Throws:
java.io.IOException
-
writeEndObject
public void writeEndObject() throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON end object character '}'.- Specified by:
writeEndObjectin classJsonGenerator- Throws:
java.io.IOException
-
writeFieldName
public void writeFieldName(java.lang.String name) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON quoted field name.- Specified by:
writeFieldNamein classJsonGenerator- Throws:
java.io.IOException
-
writeNull
public void writeNull() throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a literal JSON null value.- Specified by:
writeNullin classJsonGenerator- Throws:
java.io.IOException
-
writeString
public void writeString(java.lang.String value) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON quoted string value.- Specified by:
writeStringin classJsonGenerator- Throws:
java.io.IOException
-
writeBoolean
public void writeBoolean(boolean state) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a literal JSON boolean value ('true' or 'false').- Specified by:
writeBooleanin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(int v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON int value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(long v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON long value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(java.math.BigInteger v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON big integer value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(float v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON float value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(double v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON double value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(java.math.BigDecimal v) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON big decimal value.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
writeNumber
public void writeNumber(java.lang.String encodedValue) throws java.io.IOExceptionDescription copied from class:JsonGeneratorWrites a JSON numeric value that has already been encoded properly.- Specified by:
writeNumberin classJsonGenerator- Throws:
java.io.IOException
-
-