Package de.undercouch.bson4jackson.io
Class CountingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
de.undercouch.bson4jackson.io.CountingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Reads from another input stream, but counts the number of
bytes read or skipped (i.e. saves the current buffer position).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe position in the buffer the last timemark(int)was calledprotected intThe current buffer positionFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, markSupportedMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
_pos
protected int _posThe current buffer position -
_markpos
protected int _markposThe position in the buffer the last timemark(int)was called
-
-
Constructor Details
-
CountingInputStream
- See Also:
-
-
Method Details
-
getPosition
public int getPosition()- Returns:
- the number of bytes read or skipped
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-