public class ChannelInputStream extends 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,
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.
|
long |
skip(long n)
Skip bytes in the stream.
|
available, mark, markSupported, reset
protected final StreamSourceChannel channel
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 long skip(long n) throws IOException
skip
in class InputStream
n
- the number of bytes to skipIOException
- if an I/O error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.