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, write
Methods 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:
write
in classFilterOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-