public class FifoBuffer extends Object implements Closeable
| Constructor and Description |
|---|
FifoBuffer(int limit) |
FifoBuffer(int pageSize,
int limit) |
FifoBuffer(Object lock,
int pageSize,
int limit) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Indicates that there will be no more write.
|
InputStream |
getInputStream()
Wraps the reader end of it to
InputStream |
OutputStream |
getOutputStream()
Wraps writer end of it to
OutputStream. |
boolean |
isClosed()
Returns true if the write end of the buffer is already closed, and that
no more new data will arrive.
|
int |
peek(int offset,
byte[] data) |
int |
peek(int offset,
byte[] data,
int start,
int len)
Peek the specified number of bytes (
len) at the specified offset in this buffer (offset)
and places it into the specified position (start) of the array (data) |
int |
read(byte[] buf) |
int |
read(byte[] buf,
int start,
int len) |
int |
readable()
Number of bytes available in this buffer that are readable.
|
int |
readNonBlocking(byte[] buf) |
int |
readNonBlocking(byte[] buf,
int start,
int len) |
int |
receive(ReadableByteChannel ch)
Read bytes from a channel and stores it into this buffer.
|
int |
send(WritableByteChannel ch)
Read from this buffer write as much as possible to the channel until
the channel gets filled up.
|
void |
setLimit(int newLimit)
Set limit to the number of maximum bytes this buffer can hold.
|
int |
writable()
Number of bytes writable
|
void |
write(byte[] buf) |
void |
write(byte[] buf,
int start,
int len) |
int |
writeNonBlock(ByteBuffer buf)
Non-blocking write.
|
public FifoBuffer(int pageSize,
int limit)
public FifoBuffer(int limit)
public FifoBuffer(Object lock, int pageSize, int limit)
public void setLimit(int newLimit)
public int readable()
public int writable()
public boolean isClosed()
public int send(WritableByteChannel ch) throws IOException
IOExceptionpublic int writeNonBlock(ByteBuffer buf)
public int receive(ReadableByteChannel ch) throws IOException
IOExceptionpublic void write(byte[] buf)
throws InterruptedException,
IOException
InterruptedExceptionIOExceptionpublic void write(byte[] buf,
int start,
int len)
throws InterruptedException,
IOException
InterruptedExceptionIOExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic int peek(int offset,
byte[] data,
int start,
int len)
len) at the specified offset in this buffer (offset)
and places it into the specified position (start) of the array (data)public int peek(int offset,
byte[] data)
public int read(byte[] buf)
throws InterruptedException
InterruptedExceptionpublic int read(byte[] buf,
int start,
int len)
throws InterruptedException
InterruptedExceptionInputStream.read(byte[],int,int)public int readNonBlocking(byte[] buf)
public int readNonBlocking(byte[] buf,
int start,
int len)
InputStream.read(byte[],int,int)public OutputStream getOutputStream()
OutputStream.public InputStream getInputStream()
InputStreamCopyright © 2004-2016. All Rights Reserved.