public class UBJsonWriter
extends java.lang.Object
implements java.io.Closeable
Constructor and Description |
---|
UBJsonWriter(java.io.OutputStream out) |
Modifier and Type | Method and Description |
---|---|
UBJsonWriter |
array()
Begins a new array container.
|
UBJsonWriter |
array(java.lang.String name)
Begins a new named array container, having the given name.
|
void |
close()
Closes the underlying output stream and releases any system resources associated with the stream.
|
void |
flush()
Flushes the underlying stream.
|
UBJsonWriter |
name(java.lang.String name)
Appends a name for the next object, array, or value.
|
UBJsonWriter |
object()
Begins a new object container.
|
UBJsonWriter |
object(java.lang.String name)
Begins a new named object container, having the given name.
|
UBJsonWriter |
pop()
Ends the current object or array and pops it off of the element stack.
|
protected UBJsonWriter |
pop(boolean silent) |
UBJsonWriter |
set(java.lang.String name)
Appends a named
null array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
boolean value)
Appends a named
boolean value to the stream. |
UBJsonWriter |
set(java.lang.String name,
boolean[] value)
Appends a named
boolean array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
byte value)
Appends a named
byte value to the stream. |
UBJsonWriter |
set(java.lang.String name,
byte[] value)
Appends a named
byte array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
char value)
Appends a named
char value to the stream. |
UBJsonWriter |
set(java.lang.String name,
char[] value)
Appends a named
char array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
double value)
Appends a named
double value to the stream. |
UBJsonWriter |
set(java.lang.String name,
double[] value)
Appends a named
double array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
float value)
Appends a named
float value to the stream. |
UBJsonWriter |
set(java.lang.String name,
float[] value)
Appends a named
float array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
int value)
Appends a named
int value to the stream. |
UBJsonWriter |
set(java.lang.String name,
int[] value)
Appends a named
int array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
long value)
Appends a named
long value to the stream. |
UBJsonWriter |
set(java.lang.String name,
long[] value)
Appends a named
long array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
short value)
Appends a named
short value to the stream. |
UBJsonWriter |
set(java.lang.String name,
short[] value)
Appends a named
short array value to the stream. |
UBJsonWriter |
set(java.lang.String name,
java.lang.String value)
Appends a named
String value to the stream. |
UBJsonWriter |
set(java.lang.String name,
java.lang.String[] value)
Appends a named
String array value to the stream. |
UBJsonWriter |
value()
Appends a
null value to the stream. |
UBJsonWriter |
value(boolean value)
Appends a
boolean value to the stream. |
UBJsonWriter |
value(boolean[] values)
Appends a
boolean array value to the stream. |
UBJsonWriter |
value(byte value)
Appends a
byte value to the stream. |
UBJsonWriter |
value(byte[] values)
Appends an optimized
byte array value to the stream. |
UBJsonWriter |
value(char value)
Appends a
char value to the stream. |
UBJsonWriter |
value(char[] values)
Appends an optimized
char array value to the stream. |
UBJsonWriter |
value(double value)
Appends a
double value to the stream. |
UBJsonWriter |
value(double[] values)
Appends an optimized
double array value to the stream. |
UBJsonWriter |
value(float value)
Appends a
float value to the stream. |
UBJsonWriter |
value(float[] values)
Appends an optimized
float array value to the stream. |
UBJsonWriter |
value(int value)
Appends an
int value to the stream. |
UBJsonWriter |
value(int[] values)
Appends an optimized
int array value to the stream. |
UBJsonWriter |
value(JsonValue value)
Appends the given JsonValue, including all its fields recursively, to the stream.
|
UBJsonWriter |
value(long value)
Appends a
long value to the stream. |
UBJsonWriter |
value(long[] values)
Appends an optimized
long array value to the stream. |
UBJsonWriter |
value(java.lang.Object object)
Appends the object to the stream, if it is a known value type.
|
UBJsonWriter |
value(short value)
Appends a
short value to the stream. |
UBJsonWriter |
value(short[] values)
Appends an optimized
short array value to the stream. |
UBJsonWriter |
value(java.lang.String value)
Appends a
String value to the stream. |
UBJsonWriter |
value(java.lang.String[] values)
Appends an optimized
String array value to the stream. |
public UBJsonWriter object() throws java.io.IOException
pop()
.java.io.IOException
public UBJsonWriter object(java.lang.String name) throws java.io.IOException
pop()
.java.io.IOException
public UBJsonWriter array() throws java.io.IOException
pop()
.java.io.IOException
public UBJsonWriter array(java.lang.String name) throws java.io.IOException
pop()
.java.io.IOException
public UBJsonWriter name(java.lang.String name) throws java.io.IOException
java.io.IOException
public UBJsonWriter value(byte value) throws java.io.IOException
byte
value to the stream. This corresponds to the int8
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(short value) throws java.io.IOException
short
value to the stream. This corresponds to the int16
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(int value) throws java.io.IOException
int
value to the stream. This corresponds to the int32
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(long value) throws java.io.IOException
long
value to the stream. This corresponds to the int64
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(float value) throws java.io.IOException
float
value to the stream. This corresponds to the float32
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(double value) throws java.io.IOException
double
value to the stream. This corresponds to the float64
value type in the UBJSON
specification.java.io.IOException
public UBJsonWriter value(boolean value) throws java.io.IOException
boolean
value to the stream. This corresponds to the boolean
value type in the UBJSON
specification.java.io.IOException
public UBJsonWriter value(char value) throws java.io.IOException
char
value to the stream. Because, in Java, a char
is 16 bytes, this corresponds to the
int16
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(java.lang.String value) throws java.io.IOException
String
value to the stream. This corresponds to the string
value type in the UBJSON specification.java.io.IOException
public UBJsonWriter value(byte[] values) throws java.io.IOException
byte array
value to the stream. As an optimized array, the int8
value type marker and
element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(short[] values) throws java.io.IOException
short array
value to the stream. As an optimized array, the int16
value type marker and
element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(int[] values) throws java.io.IOException
int array
value to the stream. As an optimized array, the int32
value type marker and
element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(long[] values) throws java.io.IOException
long array
value to the stream. As an optimized array, the int64
value type marker and
element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(float[] values) throws java.io.IOException
float array
value to the stream. As an optimized array, the float32
value type marker
and element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(double[] values) throws java.io.IOException
double array
value to the stream. As an optimized array, the float64
value type marker
and element count are encoded once at the array marker instead of repeating the type marker for each element. element count
are encoded once at the array marker instead of for each element.java.io.IOException
public UBJsonWriter value(boolean[] values) throws java.io.IOException
boolean array
value to the stream.java.io.IOException
public UBJsonWriter value(char[] values) throws java.io.IOException
char array
value to the stream. As an optimized array, the int16
value type marker and
element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(java.lang.String[] values) throws java.io.IOException
String array
value to the stream. As an optimized array, the String
value type marker
and element count are encoded once at the array marker instead of repeating the type marker for each element.java.io.IOException
public UBJsonWriter value(JsonValue value) throws java.io.IOException
java.io.IOException
public UBJsonWriter value(java.lang.Object object) throws java.io.IOException
java.io.IOException
public UBJsonWriter value() throws java.io.IOException
null
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, byte value) throws java.io.IOException
byte
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, short value) throws java.io.IOException
short
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, int value) throws java.io.IOException
int
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, long value) throws java.io.IOException
long
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, float value) throws java.io.IOException
float
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, double value) throws java.io.IOException
double
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, boolean value) throws java.io.IOException
boolean
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, char value) throws java.io.IOException
char
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, java.lang.String value) throws java.io.IOException
String
value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, byte[] value) throws java.io.IOException
byte
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, short[] value) throws java.io.IOException
short
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, int[] value) throws java.io.IOException
int
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, long[] value) throws java.io.IOException
long
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, float[] value) throws java.io.IOException
float
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, double[] value) throws java.io.IOException
double
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, boolean[] value) throws java.io.IOException
boolean
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, char[] value) throws java.io.IOException
char
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name, java.lang.String[] value) throws java.io.IOException
String
array value to the stream.java.io.IOException
public UBJsonWriter set(java.lang.String name) throws java.io.IOException
null
array value to the stream.java.io.IOException
public UBJsonWriter pop() throws java.io.IOException
java.io.IOException
protected UBJsonWriter pop(boolean silent) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException