Package com.google.gson.internal.bind
Class JsonTreeWriter
java.lang.Object
com.google.gson.stream.JsonWriter
com.google.gson.internal.bind.JsonTreeWriter
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This writer creates a JsonElement.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBegins encoding a new array.Begins encoding a new object.void
close()
Flushes and closes this writer and the underlyingWriter
.endArray()
Ends encoding the current array.Ends encoding the current object.void
flush()
Ensures all buffered data is written to the underlyingWriter
and flushes that writer.get()
Returns the top level object produced by this writer.Encodes the property name.Encodesnull
.value
(boolean value) Encodesvalue
.value
(double value) Encodesvalue
.value
(long value) Encodesvalue
.Encodesvalue
.Encodesvalue
.Encodesvalue
.Methods inherited from class com.google.gson.stream.JsonWriter
getSerializeNulls, isHtmlSafe, isLenient, jsonValue, setHtmlSafe, setIndent, setLenient, setSerializeNulls
-
Constructor Details
-
JsonTreeWriter
public JsonTreeWriter()
-
-
Method Details
-
get
Returns the top level object produced by this writer. -
beginArray
Description copied from class:JsonWriter
Begins encoding a new array. Each call to this method must be paired with a call toJsonWriter.endArray()
.- Overrides:
beginArray
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
endArray
Description copied from class:JsonWriter
Ends encoding the current array.- Overrides:
endArray
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
beginObject
Description copied from class:JsonWriter
Begins encoding a new object. Each call to this method must be paired with a call toJsonWriter.endObject()
.- Overrides:
beginObject
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
endObject
Description copied from class:JsonWriter
Ends encoding the current object.- Overrides:
endObject
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
name
Description copied from class:JsonWriter
Encodes the property name.- Overrides:
name
in classJsonWriter
- Parameters:
name
- the name of the forthcoming value. May not be null.- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Parameters:
value
- the literal string value, or null to encode a null literal.- Returns:
- this writer.
- Throws:
IOException
-
nullValue
Description copied from class:JsonWriter
Encodesnull
.- Overrides:
nullValue
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Parameters:
value
- a finite value. May not beNaNs
orinfinities
.- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Returns:
- this writer.
- Throws:
IOException
-
value
Description copied from class:JsonWriter
Encodesvalue
.- Overrides:
value
in classJsonWriter
- Parameters:
value
- a finite value. May not beNaNs
orinfinities
.- Returns:
- this writer.
- Throws:
IOException
-
flush
Description copied from class:JsonWriter
Ensures all buffered data is written to the underlyingWriter
and flushes that writer.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classJsonWriter
- Throws:
IOException
-
close
Description copied from class:JsonWriter
Flushes and closes this writer and the underlyingWriter
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classJsonWriter
- Throws:
IOException
- if the JSON document is incomplete.
-