|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--cnrg.itx.datax.Channel
|
+--cnrg.itx.datax.ChannelBuffer
Looks like a channel, actually just a buffer. These are returned on a call to MixerChannel.getNewInput(). They contain all of the channel functionality that a source expects, and buffer data to be read out by the mixer.
| Inner Class Summary | |
private class |
ChannelBuffer.BigPipedInputStream
|
| Field Summary | |
private int |
behind
The number of bytes our reader dropped from us that we need to eliminate |
private int |
BUFFER_SIZE
The size of the internal buffer. |
private long |
firstPushTime
The time when the first push was executed |
private int |
iMyInstance
Instance number of the current channelbuffer; used for stat output numbering. |
(package private) static int |
instances
Number of instances of the channelbuffer; used for statistics output numbering. |
private boolean |
isDelinquent
True if the last attempt to read from this channel met an empty buffer |
private int |
MAX_CATCHUP
How many consecutive bytes are we willing to cull from a sample to try to catch up |
private java.io.PipedInputStream |
pis
The input stream used to buffer the data. |
private java.io.PipedOutputStream |
pos
The output stream used for buffering data. |
private java.io.PrintWriter |
pw
|
private int |
SAMPLE_RATE
Samples/second |
private boolean |
started
Has our source started sending yet? |
private int |
totalRead
The total number of bytes read out of the buffer |
| Fields inherited from class cnrg.itx.datax.Channel |
closed,
destinations,
INPUT,
mode,
OTHER,
OUTPUT,
pipedInput,
pipedOutput,
readerThread,
running,
SAMPLE_SIZE,
sampleSize,
source |
| Constructor Summary | |
ChannelBuffer()
Creates a new ChannelBuffer. |
|
| Method Summary | |
int |
available()
Returns the number of bytes left in the buffer. |
void |
close()
Closes the BufferChannel. |
void |
fellBehind(int by)
lets the reading channel inform the bufferChannel that it dropped bytes when our buffer was empty. |
boolean |
getDelinquent()
Gets the contents of isDelinquent. |
long |
getEarlyTime()
Returns the number of ms early we are. |
Stats |
getStatistics()
Returns the statistics for this ChannelBuffer, and its destination. |
boolean |
hasStarted()
Returns true if the source has sent data to this channel. |
void |
open()
Starts the channel's source |
void |
push(byte[] b)
Method for the source to feed data to the BufferChannel. |
int |
read()
Method for the mixer to read data out of the buffer. |
int |
read(byte[] b)
Method for the mixer to read data out of the buffer. |
int |
read(byte[] b,
int p1,
int p2)
Method for the mixer to read data out of the buffer. |
void |
setDelinquent(boolean delinq)
Sets the contents of isDelinquent. |
| Methods inherited from class cnrg.itx.datax.Channel |
addDestination,
getMode,
getProperties,
getSource,
mute,
removeAllDestinations,
removeDestination,
run,
setMode,
setPeerProperties,
setProperties,
setSource |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private boolean started
private long firstPushTime
private int totalRead
private int behind
private java.io.PipedInputStream pis
private java.io.PipedOutputStream pos
private int BUFFER_SIZE
private int SAMPLE_RATE
private int MAX_CATCHUP
private boolean isDelinquent
static int instances
private int iMyInstance
private java.io.PrintWriter pw
| Constructor Detail |
public ChannelBuffer()
| Method Detail |
public void open()
public void push(byte[] b)
b - the byte array to be buffered
public int read()
throws java.io.IOException
public int read(byte[] b)
throws java.io.IOException
b - the buffer to grab data into
public int read(byte[] b,
int p1,
int p2)
throws java.io.IOException
b - The array where the data will gop1 - the starting index in bp2 - the number of bytes to readjava.io.PipedInputStream.read
public int available()
throws java.io.IOException
public void close()
public boolean getDelinquent()
public void setDelinquent(boolean delinq)
delinq - the value setDelinquent will set isDelinquent to.public boolean hasStarted()
public long getEarlyTime()
public void fellBehind(int by)
public Stats getStatistics()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||