public class GsonJsonWriter extends Object implements JsonWriter
JsonWriter.| Constructor and Description |
|---|
GsonJsonWriter(com.google.gson.Gson gson,
Object value)
Default constructor.
|
GsonJsonWriter(com.google.gson.Gson gson,
Object value,
Type typeOfSrc)
Constructor with type parameter.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asBytes()
Get the JSON data as a byte array.
|
String |
asString()
Get the JSON data as a
String. |
void |
write(Appendable writer)
Write the JSON data to given
Appendable writer. |
void |
write(OutputStream stream,
Charset charset)
Write the JSON data to given
OutputStream, using the given Charset for encoding. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrite, writepublic GsonJsonWriter(com.google.gson.Gson gson,
Object value)
gson - Gson istance (not null)value - Value to serializepublic String asString()
JsonWriterString.asString in interface JsonWriterpublic byte[] asBytes()
JsonWriterBy default, the UTF-8 charset is used for encoding.
asBytes in interface JsonWriterpublic void write(Appendable writer)
JsonWriterAppendable writer.write in interface JsonWriterwriter - the writer into which to write the JSON data (not null)public void write(OutputStream stream, Charset charset)
JsonWriterOutputStream, using the given Charset for encoding.write in interface JsonWriterstream - the stream into which to write the JSON data (not null)charset - charset to use for encodingCopyright © 2019 The Holon Platform. All rights reserved.