Package uk.ac.starlink.util
Class CountInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
uk.ac.starlink.util.CountInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Filter input stream that counts the number of bytes read.
- Since:
- 9 May 2014
- Author:
- Mark Taylor
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
CountInputStream
Constructor.- Parameters:
in
- base input stream
-
-
Method Details
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
getReadCount
public long getReadCount()Returns the number of bytes successfully read so far from this stream.- Returns:
- number of bytes read
-
getSkipCount
public long getSkipCount()Returns the number of bytes skipped from this stream.- Returns:
- number of bytes skipped
-