Closeable, AutoCloseablepublic class TimeoutInputStream extends FilterInputStream
in| Constructor | Description |
|---|---|
TimeoutInputStream(InputStream src,
InterruptTimer timer) |
Wrap an input stream with a timeout on all read operations.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
getTimeout() |
|
int |
read() |
|
int |
read(byte[] buf) |
|
int |
read(byte[] buf,
int off,
int cnt) |
|
void |
setTimeout(int millis) |
|
long |
skip(long cnt) |
available, close, mark, markSupported, resetreadAllBytes, readNBytes, transferTopublic TimeoutInputStream(InputStream src, InterruptTimer timer)
src - base input stream (to read from). The stream must be
interruptible (most socket streams are).timer - timer to manage the timeouts during reads.public int getTimeout()
public void setTimeout(int millis)
millis - number of milliseconds before aborting a read. Must be > 0.public int read()
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] buf)
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] buf,
int off,
int cnt)
throws IOException
read in class FilterInputStreamIOExceptionpublic long skip(long cnt)
throws IOException
skip in class FilterInputStreamIOExceptionCopyright © 2018. All rights reserved.