All Packages Class Hierarchy This Package Previous Next Index
Class reliability.ReceiveBuffer
java.lang.Object
|
+----timer.TimerClient
|
+----reliability.ReceiveBuffer
- public class ReceiveBuffer
- extends TimerClient
A specialized bounded-buffer for receiving. This
buffer has the semantics that removes will wait
for data to become available but appends will
always return immediately
-
ReceiveBuffer(int)
- Set up the buffer with the given size.
-
AppendBytes(byte[])
- Append data to the end of the buffer/queue.
-
RemoveBytes(int)
- Remove maxBytes from the buffer.
ReceiveBuffer
public ReceiveBuffer(int size)
- Set up the buffer with the given size. Needs
the global timer to ensure that waiting threads
are properly woken
- Parameters:
- size - the size of the buffer in bytes
AppendBytes
public boolean AppendBytes(byte data[])
- Append data to the end of the buffer/queue.
If there is no room, then fail and return false
- Parameters:
- data - the data to append
RemoveBytes
public byte[] RemoveBytes(int maxBytes)
- Remove maxBytes from the buffer. If less
or no data is available, then block until data
becomes available.
- Parameters:
- maxBytes - the size to return
- Returns:
- the data removed
All Packages Class Hierarchy This Package Previous Next Index