Package de.undercouch.bson4jackson.io
Class BoundedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
de.undercouch.bson4jackson.io.BoundedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Input stream that bounds an underlying input stream to a particular size.
This class is not thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe number of bytes read so farprotected booleanWhether the end of the underlying stream has been reachedprotected intA marked positionprotected final intThe stream's sizeFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionBoundedInputStream(InputStream in, int size) Wraps another stream by this one -
Method Summary
Methods inherited from class java.io.FilterInputStream
close, markSupportedMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
size
protected final int sizeThe stream's size -
count
protected int countThe number of bytes read so far -
eof
protected boolean eofWhether the end of the underlying stream has been reached -
mark
protected int markA marked position
-
-
Constructor Details
-
BoundedInputStream
Wraps another stream by this one- Parameters:
in- the stream to wrapsize- the stream's size
-
-
Method Details
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
available
- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-