Quadcap Embeddable Server

com.quadcap.util.threads.Stream Class Reference

List of all members.

Detailed Description

This class implements a thread-safe stream data structure, where the stream has a fixed-size buffer of Objects.

Author:
Stan Bailes

Definition at line 54 of file Stream.java.

Public Member Functions

 Stream ()
 Construct a new stream using defaults.

 Stream (int maxSize)
 Construct a new stream with a specified buffer size.

Object read ()
 Return the next item from the stream.

void write (Object obj)
 Write an item to the stream.

void close ()
 Close this stream.


Package Attributes

int maxSize = 10
DList queue = new DList()
boolean full = false
boolean closed = false


Constructor & Destructor Documentation

com.quadcap.util.threads.Stream.Stream  ) 
 

Construct a new stream using defaults.

Definition at line 63 of file Stream.java.

com.quadcap.util.threads.Stream.Stream int  maxSize  ) 
 

Construct a new stream with a specified buffer size.

Parameters:
maxSize the maximum number of items to buffer.

Definition at line 70 of file Stream.java.


Member Function Documentation

void com.quadcap.util.threads.Stream.close  ) 
 

Close this stream.

Definition at line 133 of file Stream.java.

References com.quadcap.util.threads.Stream.closed, and com.quadcap.util.threads.Stream.queue.

Object com.quadcap.util.threads.Stream.read  ) 
 

Return the next item from the stream.

Block if the stream's empty.

Returns:
the next stream item.

Definition at line 79 of file Stream.java.

References com.quadcap.util.threads.Stream.closed, com.quadcap.util.threads.Stream.full, com.quadcap.util.DListItem.obj, com.quadcap.util.DList.popFront(), com.quadcap.util.threads.Stream.queue, and com.quadcap.util.DList.size.

void com.quadcap.util.threads.Stream.write Object  obj  ) 
 

Write an item to the stream.

Block if the stream buffer is full.

Parameters:
obj the object to write to the stream.

Definition at line 112 of file Stream.java.

References com.quadcap.util.DList.addBack(), com.quadcap.util.threads.Stream.closed, com.quadcap.util.threads.Stream.full, com.quadcap.util.threads.Stream.maxSize, com.quadcap.util.threads.Stream.queue, com.quadcap.util.DList.size, and com.quadcap.util.threads.Stream.write().

Referenced by com.quadcap.util.threads.PeriodicScheduler.run(), and com.quadcap.util.threads.Stream.write().


Member Data Documentation

boolean com.quadcap.util.threads.Stream.closed = false [package]
 

Definition at line 58 of file Stream.java.

Referenced by com.quadcap.util.threads.Stream.close(), com.quadcap.util.threads.Stream.read(), and com.quadcap.util.threads.Stream.write().

boolean com.quadcap.util.threads.Stream.full = false [package]
 

Definition at line 57 of file Stream.java.

Referenced by com.quadcap.util.threads.Stream.read(), and com.quadcap.util.threads.Stream.write().

int com.quadcap.util.threads.Stream.maxSize = 10 [package]
 

Definition at line 55 of file Stream.java.

Referenced by com.quadcap.util.threads.Stream.write().

DList com.quadcap.util.threads.Stream.queue = new DList() [package]
 

Definition at line 56 of file Stream.java.

Referenced by com.quadcap.util.threads.Stream.close(), com.quadcap.util.threads.Stream.read(), and com.quadcap.util.threads.Stream.write().