public class BufferedByteCountInputStream
extends java.io.BufferedInputStream
| Constructor and Description |
|---|
BufferedByteCountInputStream(java.io.InputStream in)
Create a new instance with a default buffer size.
|
BufferedByteCountInputStream(java.io.InputStream in,
int size)
Create a new instance with a specific buffer size.
|
BufferedByteCountInputStream(java.io.InputStream in,
long limitThroughputBytesPerSecond,
LogAdapterInterface log)
Create a new instance with throttled throughput.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getNumberOfBytesRead()
Get the number of bytes read.
|
long |
getThroughputBytesPerSecond()
Get the throughput in bytes per second.
|
int |
read()
Reads the next byte of data from this stream.
|
int |
read(byte[] b)
Reads up to byte.length bytes of data from this stream into an array of bytes.
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this stream into an array of bytes.
|
void |
resetNumberOfBytesRead()
Reset the number of bytes read to zero.
|
void |
setCallbackInterface(BufferedByteCountInputStreamCallbackInterface callbackInterface)
Set or unset the callback interface.
|
public BufferedByteCountInputStream(java.io.InputStream in)
in - the underlying input streampublic BufferedByteCountInputStream(java.io.InputStream in,
int size)
in - the underlying input streamsize - the buffer sizepublic BufferedByteCountInputStream(java.io.InputStream in,
long limitThroughputBytesPerSecond,
LogAdapterInterface log)
in - the underlying input streamlimitThroughputBytesPerSecond - the limited throughput in bytes per secondlog - the HTTP client log adapterpublic void setCallbackInterface(BufferedByteCountInputStreamCallbackInterface callbackInterface)
callbackInterface - the callback interface to set, or null to unset the callback interfacepublic int read()
throws java.io.IOException
read in class java.io.BufferedInputStreamjava.io.IOException - if an I/O error occurspublic int read(byte[] b)
throws java.io.IOException
read in class java.io.FilterInputStreamb - the buffer into which the data is readjava.io.IOException - if an I/O error occurspublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.BufferedInputStreamb - the buffer into which the data is readoff - the start offset in the bufferlen - the maximum number of bytes readjava.io.IOException - if an I/O error occurspublic long getNumberOfBytesRead()
public void resetNumberOfBytesRead()
public long getThroughputBytesPerSecond()