public class PollingInputStream
extends java.io.FilterInputStream
Constructor and Description |
---|
PollingInputStream(java.io.InputStream in,
int numAttempts,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new polling input stream.
|
PollingInputStream(java.io.InputStream in,
int numAttempts,
org.eclipse.core.runtime.IProgressMonitor monitor,
java.lang.String readTimeoutMessage,
java.lang.String closeTimeoutMessage)
Creates a new polling input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Wraps the underlying stream's method.
|
int |
read()
Wraps the underlying stream's method.
|
int |
read(byte[] buffer,
int off,
int len)
Wraps the underlying stream's method.
|
protected void |
readPendingInput()
Reads any pending input from the input stream so that the stream can
savely be closed.
|
void |
setIsCancellable(boolean cancellable)
Called to set whether cancellation will be checked by this stream.
|
long |
skip(long count)
Wraps the underlying stream's method.
|
public PollingInputStream(java.io.InputStream in, int numAttempts, org.eclipse.core.runtime.IProgressMonitor monitor)
in
- the underlying input streamnumAttempts
- the number of attempts before issuing an
InterruptedIOException, if 0, retries indefinitely until
canceledmonitor
- the progress monitor to be polled for cancellationpublic PollingInputStream(java.io.InputStream in, int numAttempts, org.eclipse.core.runtime.IProgressMonitor monitor, java.lang.String readTimeoutMessage, java.lang.String closeTimeoutMessage)
in
- the underlying input streamnumAttempts
- the number of attempts before issuing an
InterruptedIOException, if 0, retries indefinitely until
canceledmonitor
- the progress monitor to be polled for cancellationreadTimeoutMessage
- message to go with InteruptedIOException if read timeoutcloseTimeoutMessage
- message to go with InteruptedIOException if close timeoutpublic void close() throws java.io.InterruptedIOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
org.eclipse.core.runtime.OperationCanceledException
- if the progress monitor is canceledjava.io.InterruptedIOException
- if the underlying operation times out numAttempts timespublic int read() throws java.io.IOException
read
in class java.io.FilterInputStream
org.eclipse.core.runtime.OperationCanceledException
- if the progress monitor is canceledjava.io.InterruptedIOException
- if the underlying operation times out numAttempts times and
no data was received, bytesTransferred will be zerojava.io.IOException
- if an i/o error occurspublic int read(byte[] buffer, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
buffer
- - the buffer into which the data is read.off
- - the start offset of the data.len
- - the maximum number of bytes read.org.eclipse.core.runtime.OperationCanceledException
- if the progress monitor is canceledjava.io.InterruptedIOException
- if the underlying operation times out numAttempts times and
no data was received, bytesTransferred will be zerojava.io.IOException
- if an i/o error occurspublic long skip(long count) throws java.io.IOException
skip
in class java.io.FilterInputStream
count
- - the number of bytes to be skipped.org.eclipse.core.runtime.OperationCanceledException
- if the progress monitor is canceledjava.io.InterruptedIOException
- if the underlying operation times out numAttempts times and
no data was received, bytesTransferred will be zerojava.io.IOException
- if an i/o error occursprotected void readPendingInput() throws java.io.IOException
java.io.IOException
- if some problem readingpublic void setIsCancellable(boolean cancellable)
cancellable
- a flag controlling whether this stream will check for
cancellation.