public class ChannelInputStream extends 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,
TimeUnit timeoutUnit)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
available, mark, markSupported, reset, skip
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, TimeUnit timeoutUnit)
channel
- the channel to wraptimeout
- the read timeout, or O for nonetimeoutUnit
- the time unit for read timeoutspublic long getReadTimeout(TimeUnit unit)
unit
- the time unitpublic 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 interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.