java.lang.Object
de.haumacher.msgbuf.binary.OctetDataWriter
- All Implemented Interfaces:
DataWriter
DataWriter that encodes into a stream of octets (8 bit byte values).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginArray(DataType type, int length) 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 toDataWriter.beginObject().voidFinishes writing the fields of the object started with the last call toDataWriter.beginObject().voidname(int id) Writes an identifier of a field fo the currently written object.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.haumacher.msgbuf.binary.DataWriter
value
-
Constructor Details
-
OctetDataWriter
Creates aOctetDataWriter.
-
-
Method Details
-
beginObject
Description copied from interface:DataWriterStarts writing an object.A sequence of interleaving calls to
DataWriter.name(int)and a value encoding method such asDataWriter.value(int)is expected followed by a finalDataWriter.endObject()call.- Specified by:
beginObjectin interfaceDataWriter- Throws:
IOException- If writing fails.
-
endObject
Description copied from interface:DataWriterFinishes writing the fields of the object started with the last call toDataWriter.beginObject().- Specified by:
endObjectin interfaceDataWriter- Throws:
IOException- If writing fails.
-
beginArray
Description copied from interface:DataWriterStarts writing an array value with entries of the given type.- Specified by:
beginArrayin interfaceDataWriter- Parameters:
type- The type of the array elements.length- The number of elements that follow.- Throws:
IOException- If writing fails.
-
endArray
Description copied from interface:DataWriterStops writing the array started with the last call toDataWriter.beginObject().- Specified by:
endArrayin interfaceDataWriter- Throws:
IOException- If writing fails.
-
name
Description copied from interface:DataWriterWrites an identifier of a field fo the currently written object.- Specified by:
namein interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites an unsignedintvalue.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-
valueSigned
Description copied from interface:DataWriterWrites a signedintvalue.- Specified by:
valueSignedin interfaceDataWriter- Throws:
IOException- If writing fails.
-
valueFixed
Description copied from interface:DataWriterWrites a fixed size 32 bitintvalue.- Specified by:
valueFixedin interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites afloatvalue.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites an unsignedlongvalue.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-
valueSigned
Description copied from interface:DataWriterWrites a signedlongvalue.- Specified by:
valueSignedin interfaceDataWriter- Throws:
IOException- If writing fails.
-
valueFixed
Description copied from interface:DataWriterWrites a fixed size 64 bitlongvalue.- Specified by:
valueFixedin interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites adoublevalue.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites a binary string value.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-
valueBinaryStream
Description copied from interface:DataWriterStarts 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.- Specified by:
valueBinaryStreamin interfaceDataWriter- Throws:
IOException- If writing fails.
-
value
Description copied from interface:DataWriterWrites aStringvalue inutf-8encoding.- Specified by:
valuein interfaceDataWriter- Throws:
IOException- If writing fails.
-