Class CountingOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
de.tomatengames.util.io.CountingOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
A
FilterOutputStream that counts the amount of bytes written to it.
The data is passed to an underlying OutputStream.
Note that this class does not check the parameters passed to the write(...) methods,
but the underlying stream may do so.
Closing this stream closes the underlying stream.
- Since:
- 1.2
-
Field Summary
Fields inherited from class FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class FilterOutputStream
close, flushMethods inherited from class OutputStream
nullOutputStream
-
Constructor Details
-
CountingOutputStream
Creates a newCountingOutputStream.- Parameters:
out- The underlyingOutputStream.
-
-
Method Details
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
getByteCount
public long getByteCount()Returns the amount of bytes written to this stream.- Returns:
- The amount of bytes written.
-