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:
 java.io.Closeable,java.lang.AutoCloseable
public final class ThrottledInputStream extends CountingInputStream
Provides bandwidth throttling on a specified InputStream. It is implemented as a wrapper on top of another InputStream instance. The throttling works by examining the number of bytes read from the underlying InputStream from the beginning, and sleep()ing for a time interval if the byte-transfer is found exceed the specified tolerable maximum. (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, see
ThrottledInputStream.BuilderInspired by Apache HBase's class of the same name.
- Since:
 - 2.16.0
 - See Also:
 ThrottledInputStream.Builder
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThrottledInputStream.BuilderBuilds a newThrottledInputStream. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ThrottledInputStream.Builderbuilder()Constructs a newThrottledInputStream.Builder.java.lang.StringtoString()- 
Methods inherited from class org.apache.commons.io.input.CountingInputStream
getByteCount, getCount, resetByteCount, resetCount, skip 
- 
Methods inherited from class org.apache.commons.io.input.ProxyInputStream
available, close, mark, markSupported, read, read, read, reset, unwrap 
 - 
 
 - 
 
- 
- 
Method Detail
- 
builder
public static ThrottledInputStream.Builder builder()
Constructs a newThrottledInputStream.Builder.- Returns:
 - a new 
ThrottledInputStream.Builder. 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -