Class ThrottledInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.northconcepts.datapipeline.meter.MeteredInputStream
com.northconcepts.datapipeline.throttle.ThrottledInputStream
- All Implemented Interfaces:
Metered,Throttled,Closeable,AutoCloseable
A
MeteredInputStream that pauses after reads when needed to keep its average rate at or below a set number of bytes per second.-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionThrottledInputStream(InputStream in, int unitsPerSecond) Creates a stream that limits reads frominto an average ofunitsPerSecondbytes per second. -
Method Summary
Methods inherited from class com.northconcepts.datapipeline.meter.MeteredInputStream
close, getMeter, reset, skipMethods inherited from class java.io.FilterInputStream
available, mark, markSupported, readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ThrottledInputStream
Creates a stream that limits reads frominto an average ofunitsPerSecondbytes per second.
-
-
Method Details
-
getThrottle
- Specified by:
getThrottlein interfaceThrottled
-
read
- Overrides:
readin classMeteredInputStream- Throws:
IOException
-
read
- Overrides:
readin classMeteredInputStream- Throws:
IOException
-