public class TimeoutInputStream
extends java.io.FilterInputStream
| Constructor and Description |
|---|
TimeoutInputStream(java.io.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) |
public TimeoutInputStream(java.io.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 java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buf)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buf,
int off,
int cnt)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic long skip(long cnt)
throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOExceptionCopyright © 2012. All Rights Reserved.