seda.sandStorm.core
Class BufferElement

java.lang.Object
  extended by seda.sandStorm.core.BufferElement
All Implemented Interfaces:
QueueElementIF
Direct Known Subclasses:
AUdpPacket

public class BufferElement
extends java.lang.Object
implements QueueElementIF

A BufferElement is a QueueElementIF which represents a memory buffer.


Field Summary
 SinkIF compQ
          The completion queue associated with this buffer.
 byte[] data
          The data associated with this BufferElement.
 int offset
          The offet into the data associated with this BufferElement.
 int size
          The size of the data associated with this BufferElement.
 java.lang.Object userTag
          A user-defined tag object associated with this buffer.
 
Constructor Summary
BufferElement(byte[] data)
          Create a BufferElement with the given data, an offset of 0, and a size of data.length.
BufferElement(byte[] data, int offset, int size)
          Create a BufferElement with the given data, offset, and size.
BufferElement(byte[] data, int offset, int size, SinkIF compQ)
          Create a BufferElement with the given data, offset, size, and completion queue.
BufferElement(byte[] data, SinkIF compQ)
          Create a BufferElement with the given data, an offset of 0, and a size of data.length, with the given completion queue.
BufferElement(int size)
          Create a BufferElement with a new data array of the given size.
 
Method Summary
 byte[] getBytes()
          Return the data.
 SinkIF getCompletionQueue()
          Return the completion queue for this buffer.
 int getOffset()
          Return the offset.
 int getSize()
          Return the size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public byte[] data
The data associated with this BufferElement.


compQ

public SinkIF compQ
The completion queue associated with this buffer.


userTag

public java.lang.Object userTag
A user-defined tag object associated with this buffer. Can be used as a back-pointer from the buffer to application state, e.g., for handling completions.


size

public int size
The size of the data associated with this BufferElement. May not be equal to data.length; may be any value less than or equal to (data.length - offset).


offset

public int offset
The offet into the data associated with this BufferElement.

Constructor Detail

BufferElement

public BufferElement(byte[] data)
Create a BufferElement with the given data, an offset of 0, and a size of data.length.


BufferElement

public BufferElement(byte[] data,
                     SinkIF compQ)
Create a BufferElement with the given data, an offset of 0, and a size of data.length, with the given completion queue.


BufferElement

public BufferElement(byte[] data,
                     int offset,
                     int size)
Create a BufferElement with the given data, offset, and size.


BufferElement

public BufferElement(byte[] data,
                     int offset,
                     int size,
                     SinkIF compQ)
Create a BufferElement with the given data, offset, size, and completion queue.


BufferElement

public BufferElement(int size)
Create a BufferElement with a new data array of the given size.

Method Detail

getBytes

public byte[] getBytes()
Return the data.


getSize

public int getSize()
Return the size.


getOffset

public int getOffset()
Return the offset.


getCompletionQueue

public SinkIF getCompletionQueue()
Return the completion queue for this buffer.