Class BoundedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.commons.compress.utils.BoundedInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class BoundedInputStream extends java.io.InputStreamA stream that limits reading from a wrapped stream to a given number of bytes.- Since:
- 1.6
-
-
Constructor Summary
Constructors Constructor Description BoundedInputStream(java.io.InputStream in, long size)Creates the stream that will at most read the given amount of bytes from the given stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longgetBytesRemaining()intread()intread(byte[] b, int off, int len)longskip(long n)
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException- Since:
- 1.20
-
getBytesRemaining
public long getBytesRemaining()
- Returns:
- bytes remaining to read
- Since:
- 1.21
-
-