org.apache.commons.io.input
Class CountingInputStream
public class CountingInputStream
A decorating input stream that counts the number of bytes that
have passed through so far.
$Id: CountingInputStream.java 160202 2005-04-05 17:22:21Z roxspring $- Henri Yandell
- Marcelo Liberato
private int | count - The count of bytes that have passed.
|
int | getCount() - The number of bytes that have passed through this stream.
|
int | read() - Increases the count by 1 if a byte is successfully read.
|
int | read(byte[] b) - Increases the count by super.read(b)'s return count
|
int | read(byte[] b, int off, int len) - Increases the count by super.read(b, off, len)'s return count
|
int | resetCount() - Set the count back to 0.
|
long | skip(long length) - Increases the count by the number of skipped bytes.
|
count
private int count
The count of bytes that have passed.
CountingInputStream
public CountingInputStream(InputStream in)
Constructs a new CountingInputStream.
in
- InputStream to delegate to
getCount
public int getCount()
The number of bytes that have passed through this stream.
- the number of bytes accumulated
read
public int read()
throws IOException
Increases the count by 1 if a byte is successfully read.
- read in interface ProxyInputStream
java.io.InputStream.read()
read
public int read(byte[] b)
throws IOException
Increases the count by super.read(b)'s return count
- read in interface ProxyInputStream
java.io.InputStream.read(byte[])
read
public int read(byte[] b,
int off,
int len)
throws IOException
Increases the count by super.read(b, off, len)'s return count
- read in interface ProxyInputStream
java.io.InputStream.read(byte[], int, int)
resetCount
public int resetCount()
Set the count back to 0.
- the count previous to resetting.
skip
public long skip(long length)
throws IOException
Increases the count by the number of skipped bytes.
- skip in interface ProxyInputStream
java.io.InputStream.skip(long)