Class BoundedSeekableByteChannelInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.utils.BoundedArchiveInputStream
org.apache.commons.compress.utils.BoundedSeekableByteChannelInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
InputStream that delegates requests to the underlying SeekableByteChannel, making sure that only bytes from a certain range can be read.
- Since:
- 1.21
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedSeekableByteChannelInputStream(long start, long remaining, SeekableByteChannel channel) Constructs a bounded stream on the underlyingSeekableByteChannel -
Method Summary
Modifier and TypeMethodDescriptionprotected intread(long pos, ByteBuffer buf) Reads content of the stream into aByteBuffer.Methods inherited from class BoundedArchiveInputStream
read, readMethods inherited from class InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
BoundedSeekableByteChannelInputStream
public BoundedSeekableByteChannelInputStream(long start, long remaining, SeekableByteChannel channel) Constructs a bounded stream on the underlyingSeekableByteChannel- Parameters:
start- Position in the stream from where the reading of this bounded stream startsremaining- Amount of bytes which are allowed to read from the bounded streamchannel- Channel which the reads will be delegated to
-
-
Method Details
-
read
Description copied from class:BoundedArchiveInputStreamReads content of the stream into aByteBuffer.- Specified by:
readin classBoundedArchiveInputStream- Parameters:
pos- position to start the read.buf- buffer to add the read content.- Returns:
- number of read bytes.
- Throws:
IOException- if I/O fails.
-