java.lang.Object
java.io.OutputStream
org.eclipse.jgit.util.io.TimeoutOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
OutputStream with a configurable timeout.
-
Constructor Summary
ConstructorsConstructorDescriptionTimeoutOutputStream
(OutputStream destination, InterruptTimer timer) Wrap an output stream with a timeout on all write operations. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
TimeoutOutputStream
Wrap an output stream with a timeout on all write operations.- Parameters:
destination
- base input stream (to write to). The stream must be interruptible (most socket streams are).timer
- timer to manage the timeouts during writes.
-
-
Method Details
-
getTimeout
public int getTimeout()Get number of milliseconds before aborting a write.- Returns:
- number of milliseconds before aborting a write.
-
setTimeout
public void setTimeout(int millis) Set number of milliseconds before aborting a write.- Parameters:
millis
- number of milliseconds before aborting a write. Must be > 0.
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-