public class CountingInputReader
extends java.io.FilterReader
Constructor and Description |
---|
CountingInputReader(java.io.Reader reader,
long limit)
Create a CountingInputReader for the supplied Reader
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Return the total number of characters read
|
int |
read()
Read a single character
|
int |
read(char[] cbuf,
int off,
int len)
Read characters into an array starting at the specified offset
|
long |
skip(long n)
Skip characters in the input stream
|
public CountingInputReader(java.io.Reader reader, long limit)
reader
- Input readerlimit
- Maximum number of characters to be readpublic int read() throws java.io.IOException
read
in class java.io.FilterReader
java.io.IOException
- I/O error occurredpublic int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.FilterReader
cbuf
- Character arrayoff
- Starting offsetlen
- Number of characters to be readjava.io.IOException
- I/O error occurredpublic long skip(long n) throws java.io.IOException
skip
in class java.io.FilterReader
n
- Number of characters to skipjava.io.IOException
- I/O error occurredpublic long getCount()