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


Constructor Index

 o ReceiveBuffer(int)
Set up the buffer with the given size.

Method Index

 o AppendBytes(byte[])
Append data to the end of the buffer/queue.
 o RemoveBytes(int)
Remove maxBytes from the buffer.

Constructors

 o 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

Methods

 o 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
 o 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