|
XNIO API 3.1.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.xnio.streams.ChannelInputStream
public class ChannelInputStream
An input stream which reads from a stream source channel. All read operations are directly performed upon the channel, so for optimal performance, a buffering input stream should be used to wrap this class.
Field Summary | |
---|---|
protected StreamSourceChannel |
channel
|
protected boolean |
closed
|
protected long |
timeout
|
Constructor Summary | |
---|---|
ChannelInputStream(StreamSourceChannel channel)
Construct a new instance. |
|
ChannelInputStream(StreamSourceChannel channel,
long timeout,
TimeUnit timeoutUnit)
Construct a new instance. |
Method Summary | |
---|---|
void |
close()
|
long |
getReadTimeout(TimeUnit unit)
Get the read timeout. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
setReadTimeout(long timeout,
TimeUnit unit)
Set the read timeout. |
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final StreamSourceChannel channel
protected volatile boolean closed
protected volatile long timeout
Constructor Detail |
---|
public ChannelInputStream(StreamSourceChannel channel)
channel
- the channel to wrappublic ChannelInputStream(StreamSourceChannel channel, long timeout, TimeUnit timeoutUnit)
channel
- the channel to wraptimeout
- the read timeout, or O for nonetimeoutUnit
- the time unit for read timeoutsMethod 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 unitpublic int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
|
XNIO API 3.1.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |