public class TimeoutInputStream extends FilterInputStream
in| Constructor and Description |
|---|
TimeoutInputStream(InputStream src,
InterruptTimer timer)
Wrap an input stream with a timeout on all read operations.
|
| Modifier and Type | Method and 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, resetpublic 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 © 2014. All rights reserved.