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.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStreampublic java.io.InputStream getWrappedInputStream()
getWrappedInputStream in interface InputStreamWrapper