public class UBJsonWriter extends Object implements Closeable
| Constructor and Description |
|---|
UBJsonWriter(OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
UBJsonWriter |
array()
Begins a new array container.
|
UBJsonWriter |
array(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(String name)
Appends a name for the next object, array, or value.
|
UBJsonWriter |
object()
Begins a new object container.
|
UBJsonWriter |
object(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.
|
UBJsonWriter |
set(String name)
Appends a named
null array value to the stream. |
UBJsonWriter |
set(String name,
boolean value)
Appends a named
boolean value to the stream. |
UBJsonWriter |
set(String name,
boolean[] value)
Appends a named
boolean array value to the stream. |
UBJsonWriter |
set(String name,
byte value)
Appends a named
byte value to the stream. |
UBJsonWriter |
set(String name,
byte[] value)
Appends a named
byte array value to the stream. |
UBJsonWriter |
set(String name,
char value)
Appends a named
char value to the stream. |
UBJsonWriter |
set(String name,
char[] value)
Appends a named
char array value to the stream. |
UBJsonWriter |
set(String name,
double value)
Appends a named
double value to the stream. |
UBJsonWriter |
set(String name,
double[] value)
Appends a named
double array value to the stream. |
UBJsonWriter |
set(String name,
float value)
Appends a named
float value to the stream. |
UBJsonWriter |
set(String name,
float[] value)
Appends a named
float array value to the stream. |
UBJsonWriter |
set(String name,
int value)
Appends a named
int value to the stream. |
UBJsonWriter |
set(String name,
int[] value)
Appends a named
int array value to the stream. |
UBJsonWriter |
set(String name,
long value)
Appends a named
long value to the stream. |
UBJsonWriter |
set(String name,
long[] value)
Appends a named
long array value to the stream. |
UBJsonWriter |
set(String name,
short value)
Appends a named
short value to the stream. |
UBJsonWriter |
set(String name,
short[] value)
Appends a named
short array value to the stream. |
UBJsonWriter |
set(String name,
String value)
Appends a named
String value to the stream. |
UBJsonWriter |
set(String name,
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(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(String value)
Appends a
String value to the stream. |
UBJsonWriter |
value(String[] values)
Appends an optimized
String array value to the stream. |
public UBJsonWriter(OutputStream out)
public UBJsonWriter object() throws IOException
pop().IOExceptionpublic UBJsonWriter object(String name) throws IOException
pop().IOExceptionpublic UBJsonWriter array() throws IOException
pop().IOExceptionpublic UBJsonWriter array(String name) throws IOException
pop().IOExceptionpublic UBJsonWriter name(String name) throws IOException
IOExceptionpublic UBJsonWriter value(byte value) throws IOException
byte value to the stream. This corresponds to the int8 value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(short value) throws IOException
short value to the stream. This corresponds to the int16 value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(int value) throws IOException
int value to the stream. This corresponds to the int32 value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(long value) throws IOException
long value to the stream. This corresponds to the int64 value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(float value) throws IOException
float value to the stream. This corresponds to the float32 value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(double value) throws IOException
double value to the stream. This corresponds to the float64 value type in the UBJSON
specification.IOExceptionpublic UBJsonWriter value(boolean value) throws IOException
boolean value to the stream. This corresponds to the boolean value type in the UBJSON
specification.IOExceptionpublic UBJsonWriter value(char value) throws 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.IOExceptionpublic UBJsonWriter value(String value) throws IOException
String value to the stream. This corresponds to the string value type in the UBJSON specification.IOExceptionpublic UBJsonWriter value(byte[] values) throws 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.IOExceptionpublic UBJsonWriter value(short[] values) throws 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.IOExceptionpublic UBJsonWriter value(int[] values) throws 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.IOExceptionpublic UBJsonWriter value(long[] values) throws 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.IOExceptionpublic UBJsonWriter value(float[] values) throws 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.IOExceptionpublic UBJsonWriter value(double[] values) throws 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.IOExceptionpublic UBJsonWriter value(boolean[] values) throws IOException
boolean array value to the stream.IOExceptionpublic UBJsonWriter value(char[] values) throws 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.IOExceptionpublic UBJsonWriter value(String[] values) throws 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.IOExceptionpublic UBJsonWriter value(JsonValue value) throws IOException
IOExceptionpublic UBJsonWriter value(Object object) throws IOException
IOExceptionpublic UBJsonWriter value() throws IOException
null value to the stream.IOExceptionpublic UBJsonWriter set(String name, byte value) throws IOException
byte value to the stream.IOExceptionpublic UBJsonWriter set(String name, short value) throws IOException
short value to the stream.IOExceptionpublic UBJsonWriter set(String name, int value) throws IOException
int value to the stream.IOExceptionpublic UBJsonWriter set(String name, long value) throws IOException
long value to the stream.IOExceptionpublic UBJsonWriter set(String name, float value) throws IOException
float value to the stream.IOExceptionpublic UBJsonWriter set(String name, double value) throws IOException
double value to the stream.IOExceptionpublic UBJsonWriter set(String name, boolean value) throws IOException
boolean value to the stream.IOExceptionpublic UBJsonWriter set(String name, char value) throws IOException
char value to the stream.IOExceptionpublic UBJsonWriter set(String name, String value) throws IOException
String value to the stream.IOExceptionpublic UBJsonWriter set(String name, byte[] value) throws IOException
byte array value to the stream.IOExceptionpublic UBJsonWriter set(String name, short[] value) throws IOException
short array value to the stream.IOExceptionpublic UBJsonWriter set(String name, int[] value) throws IOException
int array value to the stream.IOExceptionpublic UBJsonWriter set(String name, long[] value) throws IOException
long array value to the stream.IOExceptionpublic UBJsonWriter set(String name, float[] value) throws IOException
float array value to the stream.IOExceptionpublic UBJsonWriter set(String name, double[] value) throws IOException
double array value to the stream.IOExceptionpublic UBJsonWriter set(String name, boolean[] value) throws IOException
boolean array value to the stream.IOExceptionpublic UBJsonWriter set(String name, char[] value) throws IOException
char array value to the stream.IOExceptionpublic UBJsonWriter set(String name, String[] value) throws IOException
String array value to the stream.IOExceptionpublic UBJsonWriter set(String name) throws IOException
null array value to the stream.IOExceptionpublic UBJsonWriter pop() throws IOException
IOExceptionpublic void flush()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2021. All rights reserved.