public class ProgressMonitoredInputStream extends java.io.InputStream implements InputStreamWrapper
BytesProgressWatcher
object is notified of the count of bytes read.Modifier and Type | Field and Description |
---|---|
protected BytesProgressWatcher |
progressWatcher |
Constructor and Description |
---|
ProgressMonitoredInputStream(java.io.InputStream inputStream,
BytesProgressWatcher progressWatcher)
Construts the input stream around an underlying stream and sends notification messages
to a progress watcher when bytes are read from the stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
java.io.InputStream |
getWrappedInputStream() |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
void |
resetProgressMonitor() |
void |
sendNotificationUpdate(long bytesTransmitted)
Checks how many bytes have been transferred since the last notification, and sends a notification
message if this number exceeds the minimum bytes transferred value.
|
protected BytesProgressWatcher progressWatcher
public ProgressMonitoredInputStream(java.io.InputStream inputStream, BytesProgressWatcher progressWatcher)
inputStream
- the input stream to wrap, whose byte transfer count will be monitored.progressWatcher
- a watcher object that stores information about the bytes read from a stream, and
allows calculations to be perfomed using this information.public void sendNotificationUpdate(long bytesTransmitted)
bytesTransmitted
- public void resetProgressMonitor()
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
public java.io.InputStream getWrappedInputStream()
getWrappedInputStream
in interface InputStreamWrapper