public final class JsonTreeWriter extends JsonWriter
Constructor and Description |
---|
JsonTreeWriter() |
Modifier and Type | Method and Description |
---|---|
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(java.lang.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 . |
getSerializeNulls, isHtmlSafe, isLenient, jsonValue, setHtmlSafe, setIndent, setLenient, setSerializeNulls
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(java.lang.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 interface java.io.Flushable
flush
in class JsonWriter
java.io.IOException
public void close() throws java.io.IOException
JsonWriter
Writer
.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class JsonWriter
java.io.IOException
- if the JSON document is incomplete.