Class STTimedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
com.io7m.brooklime.vanilla.internal.streamtime.STTimedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class STTimedInputStream
extends org.apache.commons.io.input.ProxyInputStream
A timed input 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.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionSTTimedInputStream(ScheduledExecutorService inExecutor, Consumer<STTransferStatistics> statsConsumer, InputStream inStream) Create an input stream.STTimedInputStream(ScheduledExecutorService inExecutor, OptionalLong expected, Consumer<STTransferStatistics> statsConsumer, InputStream inStream) Create an input stream. -
Method Summary
Methods inherited from class org.apache.commons.io.input.ProxyInputStream
afterRead, available, beforeRead, handleIOException, mark, markSupported, reset, skip, unwrapMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
STTimedInputStream
public STTimedInputStream(ScheduledExecutorService inExecutor, Consumer<STTransferStatistics> statsConsumer, InputStream inStream) Create an input stream.- Parameters:
inExecutor- A statistics executorstatsConsumer- A function that receives statistics updatesinStream- The underlying input stream
-
STTimedInputStream
public STTimedInputStream(ScheduledExecutorService inExecutor, OptionalLong expected, Consumer<STTransferStatistics> statsConsumer, InputStream inStream) Create an input stream.- Parameters:
inExecutor- A statistics executorexpected- The expected total number of octets that will be transferredstatsConsumer- A function that receives statistics updatesinStream- The underlying input stream
-
-
Method Details
-
read
- Overrides:
readin classorg.apache.commons.io.input.ProxyInputStream- Throws:
IOException
-
read
- Overrides:
readin classorg.apache.commons.io.input.ProxyInputStream- Throws:
IOException
-
read
- Overrides:
readin classorg.apache.commons.io.input.ProxyInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.commons.io.input.ProxyInputStream- Throws:
IOException
-