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, setSerializeNullspublic JsonElement get()
public JsonWriter beginArray() throws IOException
JsonWriterJsonWriter.endArray().beginArray 在类中 JsonWriterIOExceptionpublic JsonWriter endArray() throws IOException
JsonWriterendArray 在类中 JsonWriterIOExceptionpublic JsonWriter beginObject() throws IOException
JsonWriterJsonWriter.endObject().beginObject 在类中 JsonWriterIOExceptionpublic JsonWriter endObject() throws IOException
JsonWriterendObject 在类中 JsonWriterIOExceptionpublic JsonWriter name(String name) throws IOException
JsonWritername 在类中 JsonWritername - the name of the forthcoming value. May not be null.IOExceptionpublic JsonWriter value(String value) throws IOException
JsonWritervalue.value 在类中 JsonWritervalue - the literal string value, or null to encode a null literal.IOExceptionpublic JsonWriter nullValue() throws IOException
JsonWriternull.nullValue 在类中 JsonWriterIOExceptionpublic JsonWriter value(boolean value) throws IOException
JsonWritervalue.value 在类中 JsonWriterIOExceptionpublic JsonWriter value(Boolean value) throws IOException
JsonWritervalue.value 在类中 JsonWriterIOExceptionpublic JsonWriter value(double value) throws IOException
JsonWritervalue.value 在类中 JsonWritervalue - a finite value. May not be NaNs or
infinities.IOExceptionpublic JsonWriter value(long value) throws IOException
JsonWritervalue.value 在类中 JsonWriterIOExceptionpublic JsonWriter value(Number value) throws IOException
JsonWritervalue.value 在类中 JsonWritervalue - a finite value. May not be NaNs or
infinities.IOExceptionpublic void flush()
throws IOException
JsonWriterWriter
and flushes that writer.flush 在接口中 Flushableflush 在类中 JsonWriterIOExceptionpublic void close()
throws IOException
JsonWriterWriter.close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 JsonWriterIOException - if the JSON document is incomplete.