Package marauroa.common.net
Class ByteCounterOutputStream
java.lang.Object
java.io.OutputStream
marauroa.common.net.ByteCounterOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This class just counts the bytes written into underlaying outputstream
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
ByteCounterOutputStream
Constructor- Parameters:
os
- the output stream to count.
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
getBytesWritten
public long getBytesWritten()Returns the amount of bytes written.- Returns:
- the amount of bytes written.
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-