Class BoundedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.compress.utils.BoundedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
A stream that limits reading from a wrapped stream to a given number of bytes.
- Since:
- 1.6
- This class is not thread-safe
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorDescriptionBoundedInputStream
(InputStream in, long size) Creates the stream that will at most read the given amount of bytes from the given stream. -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset
-
Constructor Details
-
BoundedInputStream
Creates the stream that will at most read the given amount of bytes from the given stream.- Parameters:
in
- the stream to read fromsize
- the maximum amount of bytes to read
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
-
getBytesRemaining
- Returns:
- bytes remaining to read
- Since:
- 1.21
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
- Since:
- 1.20
-