Package com.helger.base.io.stream
Class CountingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.helger.base.io.stream.WrappedInputStream
com.helger.base.io.stream.CountingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A wrapper around an
InputStream that counts the number of read bytes.- Author:
- Philip Helger
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionCountingInputStream(@NonNull InputStream aSourceIS) Constructor wrapping the given input stream. -
Method Summary
Methods inherited from class com.helger.base.io.stream.WrappedInputStream
getWrappedInputStreamMethods inherited from class java.io.FilterInputStream
available, close, markSupported, readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
CountingInputStream
Constructor wrapping the given input stream.- Parameters:
aSourceIS- The input stream to be wrapped. May not benull.
-
-
Method Details
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
mark
public void mark(@Nonnegative int nReadlimit) - Overrides:
markin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
getBytesRead
@Nonnegative public final long getBytesRead()- Returns:
- The number of read bytes.
-
getPosition
@Nonnegative public final long getPosition()- Returns:
- The current position in the input stream (taking skip and mark/reset into account)
-
getMark
@Nonnegative public final long getMark()- Returns:
- The current mark
- Since:
- 9.3.8
-
toString
- Overrides:
toStringin classWrappedInputStream
-