Package com.helger.commons.io.stream
Class CountingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.helger.commons.io.stream.WrappedOutputStream
-
- com.helger.commons.io.stream.CountingOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class CountingOutputStream extends WrappedOutputStream
A wrapper around anOutputStreamthat counts the number of read bytes.- Author:
- Philip Helger
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description CountingOutputStream(OutputStream aSourceOS)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetBytesWritten()StringtoString()voidwrite(byte[] aBuf, int nOfs, int nLen)voidwrite(int b)-
Methods inherited from class com.helger.commons.io.stream.WrappedOutputStream
getWrappedOutputStream
-
Methods inherited from class java.io.FilterOutputStream
close, flush, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
CountingOutputStream
public CountingOutputStream(@Nonnull OutputStream aSourceOS)
-
-
Method Detail
-
write
public void write(int b) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
public void write(@Nonnull byte[] aBuf, int nOfs, int nLen) throws IOException
- Overrides:
writein classWrappedOutputStream- Throws:
IOException
-
getBytesWritten
@Nonnegative public final long getBytesWritten()
- Returns:
- The number of written bytes.
-
toString
public String toString()
- Overrides:
toStringin classWrappedOutputStream
-
-