public class OctetDataWriter extends Object implements DataWriter
DataWriter that encodes into a stream of octets (8 bit byte values).| Constructor and Description |
|---|
OctetDataWriter(OutputStream out)
Creates a
OctetDataWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
beginArray(DataType type,
int length)
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
DataWriter.beginObject(). |
void |
endObject()
Finishes writing the fields of the object started with the last call to
DataWriter.beginObject(). |
void |
name(int id)
Writes an identifier of a field fo the currently written object.
|
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvaluepublic OctetDataWriter(OutputStream out)
OctetDataWriter.public void beginObject()
throws IOException
DataWriter
A sequence of interleaving calls to DataWriter.name(int) and a value
encoding method such as DataWriter.value(int) is expected followed by a
final DataWriter.endObject() call.
beginObject in interface DataWriterIOException - If writing fails.public void endObject()
throws IOException
DataWriterDataWriter.beginObject().endObject in interface DataWriterIOException - If writing fails.public void beginArray(DataType type, int length) throws IOException
DataWriterbeginArray in interface DataWritertype - The type of the array elements.length - The number of elements that follow.IOException - If writing fails.public void endArray()
throws IOException
DataWriterDataWriter.beginObject().endArray in interface DataWriterIOException - If writing fails.public void name(int id)
throws IOException
DataWritername in interface DataWriterIOException - If writing fails.public void value(int value)
throws IOException
DataWriterint value.value in interface DataWriterIOException - If writing fails.public void valueSigned(int value)
throws IOException
DataWriterint value.valueSigned in interface DataWriterIOException - If writing fails.public void valueFixed(int value)
throws IOException
DataWriterint value.valueFixed in interface DataWriterIOException - If writing fails.public void value(float value)
throws IOException
DataWriterfloat value.value in interface DataWriterIOException - If writing fails.public void value(long value)
throws IOException
DataWriterlong value.value in interface DataWriterIOException - If writing fails.public void valueSigned(long value)
throws IOException
DataWriterlong value.valueSigned in interface DataWriterIOException - If writing fails.public void valueFixed(long value)
throws IOException
DataWriterlong value.valueFixed in interface DataWriterIOException - If writing fails.public void value(double value)
throws IOException
DataWriterdouble value.value in interface DataWriterIOException - If writing fails.public void value(byte[] value)
throws IOException
DataWritervalue in interface DataWriterIOException - If writing fails.public OutputStream valueBinaryStream() throws IOException
DataWriter
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.
valueBinaryStream in interface DataWriterIOException - If writing fails.public void value(String value) throws IOException
DataWriterString value in utf-8 encoding.value in interface DataWriterIOException - If writing fails.Copyright © 2021. All rights reserved.