public class ChannelInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
protected StreamSourceChannel |
channel |
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.
|
long |
skip(long n)
Skip bytes in the stream.
|
protected final StreamSourceChannel channel
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.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
n
- the number of bytes to skipjava.io.IOException
- if an I/O error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
Copyright © 2016 JBoss, a division of Red Hat, Inc.