public abstract class FileInStream extends InputStream implements BoundedStream, PositionedReadable, Seekable, CanUnbuffer
read()
methods to access this stream of bytes. In addition, one can seek
into a given offset of the stream to read.Constructor and Description |
---|
FileInStream() |
Modifier and Type | Method and Description |
---|---|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
int |
read(ByteBuffer buf)
Reads up to buf.remaining() bytes into buf.
|
int |
read(ByteBuffer byteBuffer,
int off,
int len)
Reads up to len bytes of data from the input stream into the byte buffer.
|
void |
unbuffer()
Reduce the buffering.
|
available, close, mark, markSupported, reset, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
remaining
positionedRead
getPos
public 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 int read(ByteBuffer buf) throws IOException
After a successful call, buf.position() will be advanced by the number of bytes read and buf.limit() should be unchanged.
In the case of an exception, the values of buf.position() and buf.limit() are undefined, and callers should be prepared to recover from this eventually.
Implementations should treat 0-length requests as legitimate, and must not signal an error upon their receipt.
buf
- the ByteBuffer to receive the results of the read operationIOException
public int read(ByteBuffer byteBuffer, int off, int len) throws IOException
byteBuffer
- the buffer into which the data is readoff
- the start offset in the buffer at which the data is writtenlen
- the maximum number of bytes to readIOException
public void unbuffer()
CanUnbuffer
unbuffer
in interface CanUnbuffer
Copyright © 2023. All Rights Reserved.