
public class ChannelInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
protected StreamSourceChannel |
channel |
protected boolean |
closed |
protected long |
timeout |
| Constructor and Description |
|---|
ChannelInputStream(StreamSourceChannel channel)
Construct a new instance.
|
ChannelInputStream(StreamSourceChannel channel,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
getReadTimeout(java.util.concurrent.TimeUnit unit)
Get the read timeout.
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
setReadTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
Set the read timeout.
|
protected final StreamSourceChannel channel
protected volatile boolean closed
protected volatile long timeout
public ChannelInputStream(StreamSourceChannel channel)
channel - the channel to wrappublic ChannelInputStream(StreamSourceChannel channel, long timeout, java.util.concurrent.TimeUnit timeoutUnit)
channel - the channel to wraptimeout - the read timeout, or O for nonetimeoutUnit - the time unit for read timeoutspublic long getReadTimeout(java.util.concurrent.TimeUnit unit)
unit - the time unitpublic void setReadTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
timeout - the read timeout, or 0 for noneunit - the time unitpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionCopyright © 2010 JBoss, a division of Red Hat, Inc.