Package com.helger.commons.io.stream
Class CountingReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- com.helger.commons.io.stream.WrappedReader
-
- com.helger.commons.io.stream.CountingReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class CountingReader extends WrappedReader
A wrapper around aReaderthat counts the number of read bytes.- Since:
- 9.3.8
- Author:
- Philip Helger
-
-
Field Summary
-
Fields inherited from class java.io.FilterReader
in
-
-
Constructor Summary
Constructors Constructor Description CountingReader(Reader aSourceReader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCharsRead()longgetMark()longgetPosition()voidmark(int nReadlimit)intread()intread(char[] aBuf, int nOffset, int nLength)voidreset()longskip(long n)StringtoString()-
Methods inherited from class com.helger.commons.io.stream.WrappedReader
getWrappedReader
-
Methods inherited from class java.io.FilterReader
close, markSupported, ready
-
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
-
-
-
Method Detail
-
read
public int read() throws IOException- Overrides:
readin classFilterReader- Throws:
IOException
-
read
public int read(char[] aBuf, int nOffset, int nLength) throws IOException- Overrides:
readin classFilterReader- Throws:
IOException
-
skip
public long skip(@Nonnegative long n) throws IOException
- Overrides:
skipin classFilterReader- Throws:
IOException
-
mark
public void mark(@Nonnegative int nReadlimit) throws IOException
- Overrides:
markin classFilterReader- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterReader- Throws:
IOException
-
getCharsRead
@Nonnegative public final long getCharsRead()
- Returns:
- The number of read chars.
-
getPosition
@Nonnegative public final long getPosition()
- Returns:
- The current position in the input stream (taking skip and mark/reset into account)
-
getMark
@Nonnegative public final long getMark()
- Returns:
- The current mark
-
toString
public String toString()
- Overrides:
toStringin classWrappedReader
-
-