org.entityfs.support.io
Class CountingInputStream
java.lang.Object
java.io.InputStream
org.entityfs.support.io.InputStreamProxy
org.entityfs.support.io.CountingInputStream
- All Implemented Interfaces:
- Closeable
public class CountingInputStream
- extends InputStreamProxy
This InputStream
counts how many bytes that the client has
read from it. The number of bytes skipped are also added to the total.
- Since:
- 1.1
- Author:
- Karl Gustafsson
- See Also:
CountingOutputStream
Constructor Summary |
CountingInputStream(InputStream wrapped)
Create a counting input stream that counts how many bytes that are read
from the wrapped stream. |
CountingInputStream
public CountingInputStream(InputStream wrapped)
- Create a counting input stream that counts how many bytes that are read
from the wrapped stream.
- Parameters:
wrapped
- The stream to read from.
read
public int read()
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
read
public int read(byte[] barr)
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
read
public int read(byte[] barr,
int off,
int len)
throws IOException
- Overrides:
read
in class InputStreamProxy
- Throws:
IOException
skip
public long skip(long n)
throws IOException
- Overrides:
skip
in class InputStreamProxy
- Throws:
IOException
mark
public void mark(int readlimit)
- This method does nothing.
- Overrides:
mark
in class InputStreamProxy
reset
public void reset()
throws IOException
- Overrides:
reset
in class InputStreamProxy
- Throws:
IOException
- Always.
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class InputStreamProxy
- Returns:
false
, always.
getNoOfBytesReadOrSkipped
public long getNoOfBytesReadOrSkipped()
- Get the number of bytes that the client has read from or skipped over in
this stream.
- Returns:
- The number of bytes that the client has read from or skipped over
in this stream.