Package com.helger.commons.io.stream
Class CountingWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- com.helger.commons.io.stream.WrappedWriter
-
- com.helger.commons.io.stream.CountingWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class CountingWriter extends WrappedWriter
A wrapper around anWriterthat counts the number of read chars.- Since:
- 9.3.8
- Author:
- Philip Helger
-
-
Field Summary
-
Fields inherited from class java.io.FilterWriter
out
-
-
Constructor Summary
Constructors Constructor Description CountingWriter(Writer aSourceOS)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCharsWritten()StringtoString()voidwrite(char[] aBuf, int nOfs, int nLen)voidwrite(int b)-
Methods inherited from class com.helger.commons.io.stream.WrappedWriter
getWrappedWriter
-
Methods inherited from class java.io.FilterWriter
close, flush, write
-
-
-
-
Method Detail
-
write
public void write(int b) throws IOException- Overrides:
writein classFilterWriter- Throws:
IOException
-
write
public void write(@Nonnull char[] aBuf, int nOfs, int nLen) throws IOException
- Overrides:
writein classFilterWriter- Throws:
IOException
-
getCharsWritten
@Nonnegative public final long getCharsWritten()
- Returns:
- The number of written chars.
-
toString
public String toString()
- Overrides:
toStringin classWrappedWriter
-
-