Class BoundedArchiveInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.utils.BoundedArchiveInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
BoundedSeekableByteChannelInputStream
NIO backed bounded input stream for reading a predefined amount of data from.
- Since:
- 1.21
- This class is thread-safe
- this base class is thread safe but implementations must not be.
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedArchiveInputStream(long start, long remaining) Constructs a new bounded input stream. -
Method Summary
Modifier and TypeMethodDescriptionintread()intread(byte[] b, int off, int len) protected abstract intread(long pos, ByteBuffer buf) Reads content of the stream into aByteBuffer.Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
-
Constructor Details
-
BoundedArchiveInputStream
Constructs a new bounded input stream.- Parameters:
start- position in the stream from where the reading of this bounded stream starts.remaining- amount of bytes which are allowed to read from the bounded stream.
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
Reads content of the stream into aByteBuffer.- 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.
-