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.OutputStream
java.io.IOException
public void write(byte[] buf) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
Copyright © 2012. All Rights Reserved.