Class ZipArchiveInputStream.BoundedInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.BoundedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- ZipArchiveInputStream
Bounded input stream adapted from commons-io
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InputStreamthe wrapped input streamprivate final longthe max length to provideprivate longthe number of bytes already returned -
Constructor Summary
ConstructorsConstructorDescriptionBoundedInputStream(InputStream in, long size) Creates a newBoundedInputStreamthat wraps the given input stream and limits it to a certain size. -
Method Summary
Methods inherited from class java.io.InputStream
close, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Field Details
-
in
the wrapped input stream -
max
private final long maxthe max length to provide -
pos
private long posthe number of bytes already returned
-
-
Constructor Details
-
BoundedInputStream
Creates a newBoundedInputStreamthat wraps the given input stream and limits it to a certain size.- Parameters:
in- The wrapped input streamsize- The maximum number of bytes to return
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-