|
XNIO API 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
org.jboss.xnio.channels.BufferedChannelInputStream
public class BufferedChannelInputStream

An input stream which reads from a stream source channel with a buffer. In addition, the
available() method can be used to determine whether the next read will or will not block.
| Constructor Summary | |
|---|---|
BufferedChannelInputStream(StreamSourceChannel channel,
int bufferSize)
Construct a new instance. |
|
BufferedChannelInputStream(StreamSourceChannel channel,
int bufferSize,
long timeout,
TimeUnit unit)
Construct a new instance. |
|
| Method Summary | |
|---|---|
int |
available()
Return the number of bytes available to read, or 0 if a subsequent read() operation would block. |
void |
close()
Close the stream. |
long |
getReadTimeout(TimeUnit unit)
Get the read timeout. |
int |
read()
Read a byte, blocking if necessary. |
int |
read(byte[] b,
int off,
int len)
Read bytes into an array. |
void |
setReadTimeout(long timeout,
TimeUnit unit)
Set the read timeout. |
long |
skip(long n)
Skip bytes in the stream. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedChannelInputStream(StreamSourceChannel channel,
int bufferSize)
channel - the channel to wrapbufferSize - the size of the internal buffer
public BufferedChannelInputStream(StreamSourceChannel channel,
int bufferSize,
long timeout,
TimeUnit unit)
channel - the channel to wrapbufferSize - the size of the internal buffertimeout - the initial read timeout, or O for noneunit - the time unit for the read timeout| Method Detail |
|---|
public long getReadTimeout(TimeUnit unit)
unit - the time unit
public void setReadTimeout(long timeout,
TimeUnit unit)
timeout - the read timeout, or 0 for noneunit - the time unit
public int read()
throws IOException
read in class InputStreamIOException - if an I/O error occurs
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamb - the destination arrayoff - the offset into the array at which bytes should be filledlen - the number of bytes to fill
IOException - if an I/O error occurs
public long skip(long n)
throws IOException
skip in class InputStreamn - the number of bytes to skip
IOException - if an I/O error occurs
public int available()
throws IOException
read() operation would block. If
a 0 is returned, the channel's resumeReads() method may be used
to register for read-readiness.
available in class InputStreamIOException - if an I/O error occurs
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException - if an I/O error occurs
|
XNIO API 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||