- All Known Implementing Classes:
OctetDataWriter
public interface DataWriter
Output interface for creating binary messages out of data objects.
Top-level, only objects must be written. Therefore, the first call to a
DataWriter must be beginObject().
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidbeginArray(DataType type, int lenght) Starts writing an array value with entries of the given type.voidStarts writing an object.voidendArray()Stops writing the array started with the last call tobeginObject().voidFinishes 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.voidWrites aStringvalue inutf-8encoding.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 Details
-
beginObject
Starts 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
Finishes writing the fields of the object started with the last call tobeginObject().- Throws:
IOException- If writing fails.
-
name
Writes an identifier of a field fo the currently written object.- Throws:
IOException- If writing fails.
-
value
Writes abooleanvalue.- Throws:
IOException- If writing fails.
-
value
Writes an unsignedintvalue.- Throws:
IOException- If writing fails.
-
valueSigned
Writes a signedintvalue.- Throws:
IOException- If writing fails.
-
valueFixed
Writes a fixed size 32 bitintvalue.- Throws:
IOException- If writing fails.
-
value
Writes an unsignedlongvalue.- Throws:
IOException- If writing fails.
-
valueSigned
Writes a signedlongvalue.- Throws:
IOException- If writing fails.
-
valueFixed
Writes a fixed size 64 bitlongvalue.- Throws:
IOException- If writing fails.
-
value
Writes afloatvalue.- Throws:
IOException- If writing fails.
-
value
Writes adoublevalue.- Throws:
IOException- If writing fails.
-
value
Writes aStringvalue inutf-8encoding.- Throws:
IOException- If writing fails.
-
value
Writes a binary string value.- Throws:
IOException- If writing fails.
-
valueBinaryStream
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
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
Stops writing the array started with the last call tobeginObject().- Throws:
IOException- If writing fails.
-