public final class JsonTreeWriter extends JsonWriter
构造器和说明 |
---|
JsonTreeWriter() |
限定符和类型 | 方法和说明 |
---|---|
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(String name)
Encodes the property name.
|
JsonWriter |
nullValue()
Encodes
null . |
JsonWriter |
value(boolean value)
Encodes
value . |
JsonWriter |
value(Boolean value)
Encodes
value . |
JsonWriter |
value(double value)
Encodes
value . |
JsonWriter |
value(long value)
Encodes
value . |
JsonWriter |
value(Number value)
Encodes
value . |
JsonWriter |
value(String value)
Encodes
value . |
getSerializeNulls, isHtmlSafe, isLenient, jsonValue, setHtmlSafe, setIndent, setLenient, setSerializeNulls
public JsonElement get()
public JsonWriter beginArray() throws IOException
JsonWriter
JsonWriter.endArray()
.beginArray
在类中 JsonWriter
IOException
public JsonWriter endArray() throws IOException
JsonWriter
endArray
在类中 JsonWriter
IOException
public JsonWriter beginObject() throws IOException
JsonWriter
JsonWriter.endObject()
.beginObject
在类中 JsonWriter
IOException
public JsonWriter endObject() throws IOException
JsonWriter
endObject
在类中 JsonWriter
IOException
public JsonWriter name(String name) throws IOException
JsonWriter
name
在类中 JsonWriter
name
- the name of the forthcoming value. May not be null.IOException
public JsonWriter value(String value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
value
- the literal string value, or null to encode a null literal.IOException
public JsonWriter nullValue() throws IOException
JsonWriter
null
.nullValue
在类中 JsonWriter
IOException
public JsonWriter value(boolean value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
IOException
public JsonWriter value(Boolean value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
IOException
public JsonWriter value(double value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
value
- a finite value. May not be NaNs
or
infinities
.IOException
public JsonWriter value(long value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
IOException
public JsonWriter value(Number value) throws IOException
JsonWriter
value
.value
在类中 JsonWriter
value
- a finite value. May not be NaNs
or
infinities
.IOException
public void flush() throws IOException
JsonWriter
Writer
and flushes that writer.flush
在接口中 Flushable
flush
在类中 JsonWriter
IOException
public void close() throws IOException
JsonWriter
Writer
.close
在接口中 Closeable
close
在接口中 AutoCloseable
close
在类中 JsonWriter
IOException
- if the JSON document is incomplete.