public interface DataWriter
Top-level, only objects must be written. Therefore, the first call to a
DataWriter must be beginObject().
beginObject(),
DataReader| Modifier and Type | Method and Description |
|---|---|
void |
beginArray(DataType type,
int lenght)
Starts writing an array value with entries of the given type.
|
void |
beginObject()
Starts writing an object.
|
void |
endArray()
Stops writing the array started with the last call to
beginObject(). |
void |
endObject()
Finishes writing the fields of the object started with the last call to
beginObject(). |
void |
name(int id)
Writes an identifier of a field fo the currently written object.
|
default void |
value(boolean value)
Writes a
boolean value. |
void |
value(byte[] value)
Writes a binary string value.
|
void |
value(double value)
Writes a
double value. |
void |
value(float value)
Writes a
float value. |
void |
value(int value)
Writes an unsigned
int value. |
void |
value(long value)
Writes an unsigned
long value. |
void |
value(String value)
Writes a
String value in utf-8 encoding. |
OutputStream |
valueBinaryStream()
Starts writing a binary value of arbitrary length in chunked mode.
|
void |
valueFixed(int value)
Writes a fixed size 32 bit
int value. |
void |
valueFixed(long value)
Writes a fixed size 64 bit
long value. |
void |
valueSigned(int value)
Writes a signed
int value. |
void |
valueSigned(long value)
Writes a signed
long value. |
void beginObject()
throws IOException
A sequence of interleaving calls to name(int) and a value
encoding method such as value(int) is expected followed by a
final endObject() call.
IOException - If writing fails.void endObject()
throws IOException
beginObject().IOException - If writing fails.void name(int id) throws IOException
IOException - If writing fails.default void value(boolean value)
throws IOException
boolean value.IOException - If writing fails.void value(int value)
throws IOException
int value.IOException - If writing fails.void valueSigned(int value)
throws IOException
int value.IOException - If writing fails.void valueFixed(int value)
throws IOException
int value.IOException - If writing fails.void value(long value)
throws IOException
long value.IOException - If writing fails.void valueSigned(long value)
throws IOException
long value.IOException - If writing fails.void valueFixed(long value)
throws IOException
long value.IOException - If writing fails.void value(float value)
throws IOException
float value.IOException - If writing fails.void value(double value)
throws IOException
double value.IOException - If writing fails.void value(String value) throws IOException
String value in utf-8 encoding.IOException - If writing fails.void value(byte[] value)
throws IOException
IOException - If writing fails.OutputStream valueBinaryStream() throws IOException
The binary contents must be written the the resulting
OutputStream. No other methods of this DataWriter must be
called before the resulting OutputStream has been
closed.
IOException - If writing fails.void beginArray(DataType type, int lenght) throws IOException
type - The type of the array elements.lenght - The number of elements that follow.IOException - If writing fails.void endArray()
throws IOException
beginObject().IOException - If writing fails.Copyright © 2021. All rights reserved.