Class JsonGenerator
java.lang.Object
com.google.api.client.json.JsonGenerator
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
- Direct Known Subclasses:
GsonGenerator, JacksonGenerator, MockJsonGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Closes the serializer and the underlying output stream or writer, and releases any memory associated with it.voidRequests that the output be pretty printed (by default it is not).abstract voidflush()Flushes any buffered content to the underlying output stream or writer.abstract JsonFactoryReturns the JSON factory from which this generator was created.private voidfinal voidSerializes the given JSON value object, or ifvalueisnullit does no serialization.abstract voidwriteBoolean(boolean state) Writes a literal JSON boolean value ('true' or 'false').abstract voidWrites a JSON end array character ']'.abstract voidWrites a JSON end object character '}'.abstract voidwriteFieldName(String name) Writes a JSON quoted field name.abstract voidWrites a literal JSON null value.abstract voidwriteNumber(double v) Writes a JSON double value.abstract voidwriteNumber(float v) Writes a JSON float value.abstract voidwriteNumber(int v) Writes a JSON int value.abstract voidwriteNumber(long v) Writes a JSON long value.abstract voidwriteNumber(String encodedValue) Writes a JSON numeric value that has already been encoded properly.abstract voidWrites a JSON big decimal value.abstract voidWrites a JSON big integer value.abstract voidWrites a JSON start array character '['.abstract voidWrites a JSON start object character '{'.abstract voidwriteString(String value) Writes a JSON quoted string value.
-
Constructor Details
-
JsonGenerator
public JsonGenerator()
-
-
Method Details
-
getFactory
Returns the JSON factory from which this generator was created. -
flush
Flushes any buffered content to the underlying output stream or writer.- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
Closes the serializer and the underlying output stream or writer, and releases any memory associated with it.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
writeStartArray
Writes a JSON start array character '['.- Throws:
IOException
-
writeEndArray
Writes a JSON end array character ']'.- Throws:
IOException
-
writeStartObject
Writes a JSON start object character '{'.- Throws:
IOException
-
writeEndObject
Writes a JSON end object character '}'.- Throws:
IOException
-
writeFieldName
Writes a JSON quoted field name.- Throws:
IOException
-
writeNull
Writes a literal JSON null value.- Throws:
IOException
-
writeString
Writes a JSON quoted string value.- Throws:
IOException
-
writeBoolean
Writes a literal JSON boolean value ('true' or 'false').- Throws:
IOException
-
writeNumber
Writes a JSON int value.- Throws:
IOException
-
writeNumber
Writes a JSON long value.- Throws:
IOException
-
writeNumber
Writes a JSON big integer value.- Throws:
IOException
-
writeNumber
Writes a JSON float value.- Throws:
IOException
-
writeNumber
Writes a JSON double value.- Throws:
IOException
-
writeNumber
Writes a JSON big decimal value.- Throws:
IOException
-
writeNumber
Writes a JSON numeric value that has already been encoded properly.- Throws:
IOException
-
serialize
Serializes the given JSON value object, or ifvalueisnullit does no serialization.- Throws:
IOException
-
serialize
- Throws:
IOException
-
enablePrettyPrint
Requests that the output be pretty printed (by default it is not).Default implementation does nothing, but implementations may override to provide actual pretty printing.
- Throws:
IOException- possible I/O exception (unused in default implementation)- Since:
- 1.6
-