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. |
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-21, Acoustic Research Laboratory, National University of Singapore, and Subnero Pte Ltd