public class TimeoutOutputStream
extends java.io.OutputStream
| Constructor and Description |
|---|
TimeoutOutputStream(java.io.OutputStream destination,
InterruptTimer timer)
Wrap an output stream with a timeout on all write operations.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
int |
getTimeout() |
void |
setTimeout(int millis) |
void |
write(byte[] buf) |
void |
write(byte[] buf,
int off,
int len) |
void |
write(int b) |
public TimeoutOutputStream(java.io.OutputStream destination,
InterruptTimer timer)
destination - base input stream (to write to). The stream must be
interruptible (most socket streams are).timer - timer to manage the timeouts during writes.public int getTimeout()
public void setTimeout(int millis)
millis - number of milliseconds before aborting a write. Must be > 0.public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] buf)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] buf,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionCopyright © 2012. All Rights Reserved.