public class ProgressMonitorInputStream extends FilterInputStream
ProgressMonitor
.in
Constructor and Description |
---|
ProgressMonitorInputStream(Component component,
Object message,
InputStream stream)
Creates a new
ProgressMonitorInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the input stream and the associated
ProgressMonitor . |
ProgressMonitor |
getProgressMonitor()
Returns the
ProgressMonitor used by this input stream. |
int |
read()
Reads an unsigned byte from the input stream and returns it as an
int in the range of 0-255. |
int |
read(byte[] data)
Reads bytes from the input stream and stores them in the supplied array,
and updates the progress monitor (or closes it if the end of the stream
is reached).
|
int |
read(byte[] data,
int offset,
int length)
Reads up to
length bytes from the input stream and stores
them in the supplied array at the given index, and updates the progress
monitor (or closes it if the end of the stream is reached). |
void |
reset()
Resets the input stream to the point where
FilterInputStream.mark(int) was called. |
long |
skip(long length)
Skips the specified number of bytes and updates the
ProgressMonitor . |
available, mark, markSupported
public ProgressMonitorInputStream(Component component, Object message, InputStream stream)
ProgressMonitorInputStream
.component
- the parent component for the progress monitor dialog.message
- the task description.stream
- the underlying input stream.public void reset() throws IOException
FilterInputStream.mark(int)
was called.reset
in class FilterInputStream
IOException
- TODOpublic int read() throws IOException
int
in the range of 0-255. Returns -1 if the end of the
stream has been reached. The progress monitor is updated.read
in class FilterInputStream
IOException
- if there is a problem reading the stream.public int read(byte[] data) throws IOException
read
in class FilterInputStream
data
- the data array for returning bytes read from the stream.IOException
- if there is a problem reading bytes from the stream.public int read(byte[] data, int offset, int length) throws IOException
length
bytes from the input stream and stores
them in the supplied array at the given index, and updates the progress
monitor (or closes it if the end of the stream is reached).read
in class FilterInputStream
data
- the data array for returning bytes read from the stream.offset
- the offset into the array where the bytes should be written.length
- the maximum number of bytes to read from the stream.IOException
- if there is a problem reading bytes from the stream.public long skip(long length) throws IOException
ProgressMonitor
.skip
in class FilterInputStream
length
- the number of bytes to skip.IOException
- if there is a problem skipping bytes in the stream.public void close() throws IOException
ProgressMonitor
.close
in interface Closeable
close
in class FilterInputStream
IOException
- if there is a problem closing the input stream.public ProgressMonitor getProgressMonitor()
ProgressMonitor
used by this input stream.