-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class CountingInputStream extends InputStream
An input stream that counts the bytes read from it.
-
-
Field Summary
Fields Modifier and Type Field Description private intcounter
-
Constructor Summary
Constructors Constructor Description CountingInputStream(InputStream in)Constructs a new CountingInputStreamwrapping the supplied input stream.
-
Method Summary
Modifier and Type Method Description intgetCounter()Returns the number of bytes read since the last reset. intread()voidresetCounter()Resets the counter to zero. -
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CountingInputStream
CountingInputStream(InputStream in)
Constructs a newCountingInputStreamwrapping the supplied input stream.
-
-
Method Detail
-
getCounter
int getCounter()
Returns the number of bytes read since the last reset.
-
read
int read()
-
resetCounter
void resetCounter()
Resets the counter to zero.
-
-
-
-