A utility class to help compose PDUs.
This class extends a ByteArrayOutputStream and adds methods to help
compose PDUs. The PDU can then be converted to a byte array using
the toByteArray() method.
Constructor and description |
---|
OutputPDU
(int size) Constructs a PDU of a given initial size. |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
write(byte[] buf) Writes a byte buffer to the PDU. |
|
void |
write16(int x) Writes a 16-bit word to the PDU. |
|
void |
write24(int x) Writes a 24-bit word to the PDU. |
|
void |
write32(int x) Writes a 32-bit word to the PDU. |
|
void |
write32(long x) Writes a 32-bit word to the PDU. |
|
void |
write48(long x) Writes a 48-bit word to the PDU. |
|
void |
write8(int x) Writes a byte to the PDU. |
Methods inherited from class | Name |
---|---|
class ByteArrayOutputStream |
toString, toString, toString, size, write, write, close, reset, toByteArray, writeTo, write, flush, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
class OutputStream |
write, write, write, flush, close, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructs a PDU of a given initial size.
size
- initial size in bytesWrites a byte buffer to the PDU.
buf
- buffer to writeWrites a 16-bit word to the PDU.
x
- word to writeWrites a 24-bit word to the PDU.
x
- word to writeWrites a 32-bit word to the PDU.
x
- word to writeWrites a 32-bit word to the PDU.
x
- word to writeWrites a 48-bit word to the PDU.
x
- word to writeWrites a byte to the PDU.
x
- byte to writeCopyright 2013-19, Acoustic Research Laboratory, National University of Singapore, and Subnero Pte Ltd