class BoundedSeekableByteChannelInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
private java.nio.ByteBuffer |
buffer |
private long |
bytesRemaining |
private java.nio.channels.SeekableByteChannel |
channel |
private static int |
MAX_BUF_LEN |
| Constructor and Description |
|---|
BoundedSeekableByteChannelInputStream(java.nio.channels.SeekableByteChannel channel,
long size) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes.
|
private int |
read(int len) |
private static final int MAX_BUF_LEN
private final java.nio.ByteBuffer buffer
private final java.nio.channels.SeekableByteChannel channel
private long bytesRemaining
public BoundedSeekableByteChannelInputStream(java.nio.channels.SeekableByteChannel channel,
long size)
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.
This implementation may return 0 if the underlying SeekableByteChannel is non-blocking and currently hasn't got
any bytes available.
read in class java.io.InputStreamjava.io.IOExceptionprivate int read(int len)
throws java.io.IOException
java.io.IOExceptionpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStream