|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.petersalomonsen.jjack.javasound.BlockingByteFIFO
public class BlockingByteFIFO
A FIFO byte buffer that blocks on read or write if trying to read or write more than is available for reading/writing.
Field Summary | |
---|---|
(package private) boolean |
blocking
|
(package private) byte[] |
buffer
|
(package private) long |
bufferPosRead
|
(package private) long |
bufferPosWrite
|
Constructor Summary | |
---|---|
BlockingByteFIFO(int size)
|
Method Summary | |
---|---|
int |
availableRead()
|
int |
availableWrite()
|
private void |
block()
|
void |
flush()
Discard unread data |
long |
getBufferPosRead()
|
long |
getBufferPosWrite()
|
int |
getBufferSize()
Return the size of the buffer |
int |
read(byte[] b,
int off,
int len)
Read into provided byteArray - will block until all data is read |
private int |
readLenOrAvailable(byte[] b,
int off,
int len)
Read all requested amount of data, or the maximum that is available for reading |
private void |
unblock()
|
int |
write(byte[] b,
int off,
int len)
Write data of provided bytearray. |
private int |
writeLenOrAvailable(byte[] b,
int off,
int len)
Write all requested amount of data, or the maximum that is available for writing |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
byte[] buffer
long bufferPosWrite
long bufferPosRead
boolean blocking
Constructor Detail |
---|
public BlockingByteFIFO(int size)
Method Detail |
---|
public int availableRead()
public int availableWrite()
public int read(byte[] b, int off, int len)
public int write(byte[] b, int off, int len)
public long getBufferPosRead()
public long getBufferPosWrite()
public int getBufferSize()
public void flush()
private void unblock()
private void block()
private int readLenOrAvailable(byte[] b, int off, int len)
private int writeLenOrAvailable(byte[] b, int off, int len)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |