public interface JsonWriter
Json| 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. |
default void |
write(OutputStream stream)
Write the JSON data to given
OutputStream, using the UTF-8 charset for encoding. |
void |
write(OutputStream stream,
Charset charset)
Write the JSON data to given
OutputStream, using the given Charset for encoding. |
default void |
write(OutputStream stream,
String charsetName)
Write the JSON data to given
OutputStream, using the given charset name for encoding. |
String asString()
String.Json.JsonWriteException - If a JSON serialization error occuredbyte[] asBytes()
By default, the UTF-8 charset is used for encoding.
Json.JsonWriteException - If a JSON serialization error occuredvoid write(Appendable writer)
Appendable writer.writer - the writer into which to write the JSON data (not null)Json.JsonWriteException - If a JSON serialization error occureddefault void write(OutputStream stream)
OutputStream, using the UTF-8 charset for encoding.stream - the stream into which to write the JSON data (not null)Json.JsonWriteException - If a JSON serialization error occureddefault void write(OutputStream stream, String charsetName)
OutputStream, using the given charset name for encoding.stream - the stream into which to write the JSON data (not null)charsetName - charset name to use for encodingJson.JsonWriteException - If a JSON serialization error occuredvoid write(OutputStream stream, Charset charset)
OutputStream, using the given Charset for encoding.stream - the stream into which to write the JSON data (not null)charset - charset to use for encodingJson.JsonWriteException - If a JSON serialization error occuredCopyright © 2019 The Holon Platform. All rights reserved.