public class JsonOutput extends Object implements StreamingOutput
| Constructor and Description |
|---|
JsonOutput(OutputStream out)
Create a JSON streamer that will write to the given output.
|
JsonOutput(OutputStream out,
boolean beautify)
Create a JSON streamer that will write to the given output, optionally
with beautification of the generated JSON.
|
JsonOutput(Writer writer)
Create a JSON streamer that will write to the given output.
|
JsonOutput(Writer writer,
boolean beautify)
Create a JSON streamer that will write to the given output, optionally
with beautification of the generated JSON.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
write(String name,
boolean bool)
Write a boolean.
|
void |
write(String name,
byte[] data)
Write a byte array to the output.
|
void |
write(String name,
double number)
Write a double.
|
void |
write(String name,
float number)
Write a float.
|
void |
write(String name,
int number)
Write an integer.
|
void |
write(String name,
long number)
Write a long.
|
void |
write(String name,
String value)
Write a string.
|
void |
writeListEnd(String name)
Write the end of a list.
|
void |
writeListStart(String name)
Write the start of a list.
|
void |
writeNull(String name)
Write a null value.
|
void |
writeObjectEnd(String name)
Write the end of an object.
|
void |
writeObjectStart(String name)
Write the start of an object.
|
protected final Writer writer
public JsonOutput(OutputStream out)
out - public JsonOutput(OutputStream out, boolean beautify)
out - beautify - public JsonOutput(Writer writer)
out - public JsonOutput(Writer writer, boolean beautify)
out - beautify - public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void writeObjectStart(String name) throws IOException
StreamingOutputwriteObjectStart in interface StreamingOutputIOExceptionpublic void writeObjectEnd(String name) throws IOException
StreamingOutputwriteObjectEnd in interface StreamingOutputIOExceptionpublic void writeListStart(String name) throws IOException
StreamingOutputwriteListStart in interface StreamingOutputIOExceptionpublic void writeListEnd(String name) throws IOException
StreamingOutputwriteListEnd in interface StreamingOutputIOExceptionpublic void write(String name, String value) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, int number) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, long number) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, float number) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, double number) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, boolean bool) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void write(String name, byte[] data) throws IOException
StreamingOutputwrite in interface StreamingOutputIOExceptionpublic void writeNull(String name) throws IOException
StreamingOutputwriteNull in interface StreamingOutputIOExceptionpublic void flush()
throws IOException
flush in interface FlushableIOExceptionCopyright © 2016. All rights reserved.