class DatagramBuffer extends Timestamped<ByteBuffer>
ByteBuffer
with a DatagramPacket
so that the
ByteBuffer
may be used for writing into a byte
array and the
DatagramPacket
may be used for reading from the same byte
array.Modifier and Type | Field and Description |
---|---|
private DatagramPacket |
datagramPacket
|
o, timestamp
Constructor and Description |
---|
DatagramBuffer(int capacity)
Initializes a new
DatagramBuffer instance with a specific
capacity of byte s shared between a ByteBuffer and a
DatagramPacket . |
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
getByteBuffer()
Gets the
ByteBuffer (view) of this instance. |
DatagramPacket |
getDatagramPacket()
Gets the
DatagramPacket (view) of this instance. |
private final DatagramPacket datagramPacket
public DatagramBuffer(int capacity)
DatagramBuffer
instance with a specific
capacity of byte
s shared between a ByteBuffer
and a
DatagramPacket
.capacity
- the maximum number of byte
s to be written into
and read from the new instancepublic ByteBuffer getByteBuffer()
ByteBuffer
(view) of this instance.ByteBuffer
(view) of this instancepublic DatagramPacket getDatagramPacket()
DatagramPacket
(view) of this instance. The
length
of the DatagramPacket
equals the position
of the ByteBuffer
so that the byte
s written into the
ByteBuffer
may be read from the DatagramPacket
.DatagramPacket
(view) of this instanceCopyright © 2018. All rights reserved.