Class MiserOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.archive.io.MiserOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
A filter stream that both counts bytes written, and optionally swallows
flush() requests.
- Author:
- gojomo
-
Field Summary
FieldsFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionWraps another output stream, counting the number of bytes written.MiserOutputStream(OutputStream out, boolean passFlushes) Wraps another output stream, counting the number of bytes written. -
Method Summary
Methods inherited from class java.io.FilterOutputStream
write
-
Field Details
-
count
protected long count -
passFlushes
protected boolean passFlushes
-
-
Constructor Details
-
MiserOutputStream
Wraps another output stream, counting the number of bytes written.- Parameters:
out- the output stream to be wrapped
-
MiserOutputStream
Wraps another output stream, counting the number of bytes written.- Parameters:
out- the output stream to be wrapped
-
-
Method Details
-
getCount
public long getCount()Returns the number of bytes written. -
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-