Closeable
, AutoCloseable
public 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, reset
readAllBytes, readNBytes, transferTo
public 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 FilterInputStream
IOException
public int read(byte[] buf) throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] buf, int off, int cnt) throws IOException
read
in class FilterInputStream
IOException
public long skip(long cnt) throws IOException
skip
in class FilterInputStream
IOException
Copyright © 2018. All rights reserved.