public class TimeoutOutputStream extends OutputStream
| Constructor and Description |
|---|
TimeoutOutputStream(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(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 IOException
write in class OutputStreamIOExceptionpublic void write(byte[] buf)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] buf,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionCopyright © 2014. All rights reserved.