Class CountingOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.deltava.dao.http.CountingOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An OutputStream that counts the number of bytes written to it.
- Since:
- 10.3
- Version:
- 10.3
- Author:
- Luke
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionCountingOutputStream(OutputStream out, IntConsumer onClose) Creates the OutputStream. -
Method Summary
Methods inherited from class java.io.FilterOutputStream
flush, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
CountingOutputStream
Creates the OutputStream.- Parameters:
out- the OutputStream to wraponClose- statistics update hook, called on close()
-
-
Method Details
-
getCount
public int getCount()Returns the number of bytes written to this stream.- Returns:
- the number of bytes
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-