org.eclipse.jgit.util.io
Class TimeoutInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.eclipse.jgit.util.io.TimeoutInputStream
- All Implemented Interfaces:
- Closeable
public class TimeoutInputStream
- extends FilterInputStream
InputStream with a configurable timeout.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeoutInputStream
public TimeoutInputStream(InputStream src,
InterruptTimer timer)
- Wrap an input stream with a timeout on all read operations.
- Parameters:
src
- base input stream (to read from). The stream must be
interruptible (most socket streams are).timer
- timer to manage the timeouts during reads.
getTimeout
public int getTimeout()
- Returns:
- number of milliseconds before aborting a read.
setTimeout
public void setTimeout(int millis)
- Parameters:
millis
- number of milliseconds before aborting a read. Must be > 0.
read
public int read()
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] buf)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] buf,
int off,
int cnt)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
skip
public long skip(long cnt)
throws IOException
- Overrides:
skip
in class FilterInputStream
- Throws:
IOException
Copyright © 2012. All Rights Reserved.