-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class BoundedInputStream extends InputStream
A stream that limits reading from a wrapped stream to a given number of bytes.
-
-
Field Summary
Fields Modifier and Type Field Description private longbytesRemaining
-
Constructor Summary
Constructors Constructor Description BoundedInputStream(InputStream in, long size)Creates the stream that will at most read the given amount ofbytes from the given stream.
-
Method Summary
Modifier and Type Method Description longgetBytesRemaining()voidclose()intread()intread(Array<byte> b, int off, int len)longskip(long n)-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BoundedInputStream
BoundedInputStream(InputStream in, long size)
Creates the stream that will at most read the given amount ofbytes from the given stream.- Parameters:
in- the stream to read fromsize- the maximum amount of bytes to read
-
-
-
-