-
- All Known Implementing Classes:
OctetDataWriter
public interface DataWriterOutput interface for creating binary messages out of data objects.Top-level, only objects must be written. Therefore, the first call to a
DataWritermust bebeginObject().- See Also:
beginObject(),DataReader
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidbeginArray(DataType type, int lenght)Starts writing an array value with entries of the given type.voidbeginObject()Starts writing an object.voidendArray()Stops writing the array started with the last call tobeginObject().voidendObject()Finishes writing the fields of the object started with the last call tobeginObject().voidname(int id)Writes an identifier of a field fo the currently written object.default voidvalue(boolean value)Writes abooleanvalue.voidvalue(byte[] value)Writes a binary string value.voidvalue(double value)Writes adoublevalue.voidvalue(float value)Writes afloatvalue.voidvalue(int value)Writes an unsignedintvalue.voidvalue(long value)Writes an unsignedlongvalue.voidvalue(String value)Writes aStringvalue inutf-8encoding.OutputStreamvalueBinaryStream()Starts writing a binary value of arbitrary length in chunked mode.voidvalueFixed(int value)Writes a fixed size 32 bitintvalue.voidvalueFixed(long value)Writes a fixed size 64 bitlongvalue.voidvalueSigned(int value)Writes a signedintvalue.voidvalueSigned(long value)Writes a signedlongvalue.
-
-
-
Method Detail
-
beginObject
void beginObject() throws IOExceptionStarts writing an object.A sequence of interleaving calls to
name(int)and a value encoding method such asvalue(int)is expected followed by a finalendObject()call.- Throws:
IOException- If writing fails.
-
endObject
void endObject() throws IOExceptionFinishes writing the fields of the object started with the last call tobeginObject().- Throws:
IOException- If writing fails.
-
name
void name(int id) throws IOException
Writes an identifier of a field fo the currently written object.- Throws:
IOException- If writing fails.
-
value
default void value(boolean value) throws IOExceptionWrites abooleanvalue.- Throws:
IOException- If writing fails.
-
value
void value(int value) throws IOExceptionWrites an unsignedintvalue.- Throws:
IOException- If writing fails.
-
valueSigned
void valueSigned(int value) throws IOExceptionWrites a signedintvalue.- Throws:
IOException- If writing fails.
-
valueFixed
void valueFixed(int value) throws IOExceptionWrites a fixed size 32 bitintvalue.- Throws:
IOException- If writing fails.
-
value
void value(long value) throws IOExceptionWrites an unsignedlongvalue.- Throws:
IOException- If writing fails.
-
valueSigned
void valueSigned(long value) throws IOExceptionWrites a signedlongvalue.- Throws:
IOException- If writing fails.
-
valueFixed
void valueFixed(long value) throws IOExceptionWrites a fixed size 64 bitlongvalue.- Throws:
IOException- If writing fails.
-
value
void value(float value) throws IOExceptionWrites afloatvalue.- Throws:
IOException- If writing fails.
-
value
void value(double value) throws IOExceptionWrites adoublevalue.- Throws:
IOException- If writing fails.
-
value
void value(String value) throws IOException
Writes aStringvalue inutf-8encoding.- Throws:
IOException- If writing fails.
-
value
void value(byte[] value) throws IOExceptionWrites a binary string value.- Throws:
IOException- If writing fails.
-
valueBinaryStream
OutputStream valueBinaryStream() throws IOException
Starts writing a binary value of arbitrary length in chunked mode.The binary contents must be written the the resulting
OutputStream. No other methods of thisDataWritermust be called before the resultingOutputStreamhas beenclosed.- Throws:
IOException- If writing fails.
-
beginArray
void beginArray(DataType type, int lenght) throws IOException
Starts writing an array value with entries of the given type.- Parameters:
type- The type of the array elements.lenght- The number of elements that follow.- Throws:
IOException- If writing fails.
-
endArray
void endArray() throws IOExceptionStops writing the array started with the last call tobeginObject().- Throws:
IOException- If writing fails.
-
-