java.lang.Objectcom.google.gson.stream.JsonWriter
com.google.gson.internal.bind.JsonTreeWriter
public final class JsonTreeWriter
This writer creates a JsonElement.
Constructor Summary | |
---|---|
JsonTreeWriter()
|
Method Summary | |
---|---|
JsonWriter |
beginArray()
Begins encoding a new array. |
JsonWriter |
beginObject()
Begins encoding a new object. |
void |
close()
Flushes and closes this writer and the underlying Writer . |
JsonWriter |
endArray()
Ends encoding the current array. |
JsonWriter |
endObject()
Ends encoding the current object. |
void |
flush()
Ensures all buffered data is written to the underlying Writer
and flushes that writer. |
JsonElement |
get()
Returns the top level object produced by this writer. |
JsonWriter |
name(java.lang.String name)
Encodes the property name. |
JsonWriter |
nullValue()
Encodes null . |
JsonWriter |
value(boolean value)
Encodes value . |
JsonWriter |
value(double value)
Encodes value . |
JsonWriter |
value(long value)
Encodes value . |
JsonWriter |
value(java.lang.Number value)
Encodes value . |
JsonWriter |
value(java.lang.String value)
Encodes value . |
Methods inherited from class com.google.gson.stream.JsonWriter |
---|
getSerializeNulls, isHtmlSafe, isLenient, setHtmlSafe, setIndent, setLenient, setSerializeNulls |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsonTreeWriter()
Method Detail |
---|
public JsonElement get()
public JsonWriter beginArray() throws java.io.IOException
JsonWriter
JsonWriter.endArray()
.
beginArray
in class JsonWriter
java.io.IOException
public JsonWriter endArray() throws java.io.IOException
JsonWriter
endArray
in class JsonWriter
java.io.IOException
public JsonWriter beginObject() throws java.io.IOException
JsonWriter
JsonWriter.endObject()
.
beginObject
in class JsonWriter
java.io.IOException
public JsonWriter endObject() throws java.io.IOException
JsonWriter
endObject
in class JsonWriter
java.io.IOException
public JsonWriter name(java.lang.String name) throws java.io.IOException
JsonWriter
name
in class JsonWriter
name
- the name of the forthcoming value. May not be null.
java.io.IOException
public JsonWriter value(java.lang.String value) throws java.io.IOException
JsonWriter
value
.
value
in class JsonWriter
value
- the literal string value, or null to encode a null literal.
java.io.IOException
public JsonWriter nullValue() throws java.io.IOException
JsonWriter
null
.
nullValue
in class JsonWriter
java.io.IOException
public JsonWriter value(boolean value) throws java.io.IOException
JsonWriter
value
.
value
in class JsonWriter
java.io.IOException
public JsonWriter value(double value) throws java.io.IOException
JsonWriter
value
.
value
in class JsonWriter
value
- a finite value. May not be NaNs
or
infinities
.
java.io.IOException
public JsonWriter value(long value) throws java.io.IOException
JsonWriter
value
.
value
in class JsonWriter
java.io.IOException
public JsonWriter value(java.lang.Number value) throws java.io.IOException
JsonWriter
value
.
value
in class JsonWriter
value
- a finite value. May not be NaNs
or
infinities
.
java.io.IOException
public void flush() throws java.io.IOException
JsonWriter
Writer
and flushes that writer.
flush
in class JsonWriter
java.io.IOException
public void close() throws java.io.IOException
JsonWriter
Writer
.
close
in interface java.io.Closeable
close
in class JsonWriter
java.io.IOException
- if the JSON document is incomplete.