| Modifier and Type | Field and Description |
|---|---|
| private final InterruptTimer | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | TimeoutInputStream(final InputStream
base input stream (to read from). The stream must be
interruptible (most socket streams are). src, final InterruptTimer timer to manage the timeouts during reads. timer)Wrap an input stream with a timeout on all read operations. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public int | Returns: number of milliseconds before aborting a read.Get number of milliseconds before aborting a read. |
| public int | |
| public int | read(byte[]
the buffer into which the data is read. buf)Overrides java. Reads up to |
| public int | read(byte[]
the buffer into which the data is read. buf, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. cnt)Overrides java. Reads up to |
| private InterruptedIOException | |
| public void | setTimeout(int
number of milliseconds before aborting a read. Must be > 0. millis)Set number of milliseconds before aborting a read. |
| public long | skip(long
the number of bytes to be skipped. cnt)Overrides java. Skips over and discards |
| myTimer | back to summary |
|---|---|
| private final InterruptTimer myTimer | |
| timeout | back to summary |
|---|---|
| private int timeout | |
| TimeoutInputStream | back to summary |
|---|---|
| public TimeoutInputStream(final InputStream src, final InterruptTimer timer) Wrap an input stream with a timeout on all read operations.
| |
| beginRead | back to summary |
|---|---|
| private void beginRead() | |
| endRead | back to summary |
|---|---|
| private void endRead() | |
| getTimeout | back to summary |
|---|---|
| public int getTimeout() Get number of milliseconds before aborting a read.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] buf) throws IOException Overrides java. Doc from java. Reads up to
| |
| read | back to summary |
|---|---|
| public int read(byte[] buf, int off, int cnt) throws IOException Overrides java. Doc from java. Reads up to
| |
| readTimedOut | back to summary |
|---|---|
| private InterruptedIOException readTimedOut(InterruptedIOException e) | |
| setTimeout | back to summary |
|---|---|
| public void setTimeout(int millis) Set number of milliseconds before aborting a read.
| |
| skip | back to summary |
|---|---|
| public long skip(long cnt) throws IOException Overrides java. Doc from java. Skips over and discards
| |