- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.aoapps.hodgepodge.io.ByteCountInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ByteCountInputStream extends FilterInputStream
Wraps an InputStream to count the number of bytes transferred. Does not count bytes skipped. The counter is not synchronized. Any necessary synchronization should be externally applied.- Author:
- AO Industries, Inc.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ByteCountInputStream(InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCount()intread()intread(byte[] b)intread(byte[] b, int off, int len)-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ByteCountInputStream
public ByteCountInputStream(InputStream in)
-
-
Method Detail
-
read
public int read() throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
getCount
public long getCount()
-
-