Class ThrottledOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.northconcepts.datapipeline.meter.MeteredOutputStream
com.northconcepts.datapipeline.throttle.ThrottledOutputStream
- All Implemented Interfaces:
Metered,Throttled,Closeable,Flushable,AutoCloseable
A
MeteredOutputStream that pauses before writes 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.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionThrottledOutputStream(OutputStream out, int unitsPerSecond) Creates a stream that limits writes tooutto an average ofunitsPerSecondbytes per second. -
Method Summary
Methods inherited from class com.northconcepts.datapipeline.meter.MeteredOutputStream
close, getMeterMethods inherited from class java.io.FilterOutputStream
flush, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ThrottledOutputStream
Creates a stream that limits writes tooutto an average ofunitsPerSecondbytes per second.
-
-
Method Details
-
getThrottle
- Specified by:
getThrottlein interfaceThrottled
-
write
- Overrides:
writein classMeteredOutputStream- Throws:
IOException
-
write
- Overrides:
writein classMeteredOutputStream- Throws:
IOException
-