Class STTimedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
com.io7m.brooklime.vanilla.internal.streamtime.STTimedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public final class STTimedOutputStream
extends org.apache.commons.io.output.ProxyOutputStream
A timed output stream. The stream accepts a function that will receive
transfer statistics at a rate of one update per second.
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionSTTimedOutputStream(ScheduledExecutorService inExecutor, Consumer<STTransferStatistics> statsConsumer, OutputStream inStream) Create an output stream.STTimedOutputStream(ScheduledExecutorService inExecutor, OptionalLong expected, Consumer<STTransferStatistics> statsConsumer, OutputStream inStream) Create an output stream. -
Method Summary
Methods inherited from class org.apache.commons.io.output.ProxyOutputStream
afterWrite, beforeWrite, flush, handleIOExceptionMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
STTimedOutputStream
public STTimedOutputStream(ScheduledExecutorService inExecutor, Consumer<STTransferStatistics> statsConsumer, OutputStream inStream) Create an output stream.- Parameters:
inExecutor- A statistics executorstatsConsumer- A function that receives statistics updatesinStream- The underlying output stream
-
STTimedOutputStream
public STTimedOutputStream(ScheduledExecutorService inExecutor, OptionalLong expected, Consumer<STTransferStatistics> statsConsumer, OutputStream inStream) Create an output stream.- Parameters:
inExecutor- A statistics executorexpected- The expected total number of octets that will be transferredstatsConsumer- A function that receives statistics updatesinStream- The underlying output stream
-
-
Method Details
-
write
- Overrides:
writein classorg.apache.commons.io.output.ProxyOutputStream- Throws:
IOException
-
write
- Overrides:
writein classorg.apache.commons.io.output.ProxyOutputStream- Throws:
IOException
-
write
- Overrides:
writein classorg.apache.commons.io.output.ProxyOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.commons.io.output.ProxyOutputStream- Throws:
IOException
-