public class ProgressMonitoredInputStream extends 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(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() |
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.
|
mark, skip
protected BytesProgressWatcher progressWatcher
public ProgressMonitoredInputStream(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 IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
public InputStream getWrappedInputStream()
getWrappedInputStream
in interface InputStreamWrapper
Copyright © 2006–2018. All rights reserved.