Package org.apache.commons.io.input
Class ThrottledInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.CountingInputStream
org.apache.commons.io.input.ThrottledInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Provides bandwidth throttling on an InputStream as a filter input stream. The throttling examines the number of bytes read from the underlying InputStream,
and sleeps for a time interval if the byte-transfer is found to exceed the specified maximum rate. Thus, while the read-rate might exceed the maximum for a
short interval, the average tends towards the specified maximum, overall.
To build an instance, call builder().
Inspired by Apache HBase's class of the same name.
- Since:
- 2.16.0
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ThrottledInputStream.Builderbuilder()Constructs a newThrottledInputStream.Builder.toString()Methods inherited from class org.apache.commons.io.input.CountingInputStream
getByteCount, getCount, resetByteCount, resetCount, skipMethods inherited from class org.apache.commons.io.input.ProxyInputStream
available, close, mark, markSupported, read, read, read, reset, setReference, unwrapMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
builder
Constructs a newThrottledInputStream.Builder.- Returns:
- a new
ThrottledInputStream.Builder.
-
toString
-