| Modifier and Type | Field and Description |
|---|---|
| private final OutputStream | |
| private final InterruptTimer | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | TimeoutOutputStream(final OutputStream
base input stream (to write to). The stream must be
interruptible (most socket streams are). destination, final InterruptTimer timer to manage the timeouts during writes. timer)Wrap an output stream with a timeout on all write operations. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | close()
Overrides java. Implements java. Closes this output stream and releases any system resources associated with this stream. |
| private void | |
| public void | flush()
Overrides java. Implements java. Flushes this output stream and forces any buffered output bytes to be written out. |
| public int | Returns: number of milliseconds before aborting a write.Get number of milliseconds before aborting a write. |
| public void | setTimeout(int
number of milliseconds before aborting a write. Must be >
0. millis)Set number of milliseconds before aborting a write. |
| public void | write(int
the b)byte.Implements abstract java. Writes the specified byte to this output stream. |
| public void | write(byte[]
the data. buf)Overrides java. Writes |
| public void | write(byte[]
the data. buf, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. Writes |
| private InterruptedIOException |
| dst | back to summary |
|---|---|
| private final OutputStream dst | |
| myTimer | back to summary |
|---|---|
| private final InterruptTimer myTimer | |
| timeout | back to summary |
|---|---|
| private int timeout | |
| TimeoutOutputStream | back to summary |
|---|---|
| public TimeoutOutputStream(final OutputStream destination, final InterruptTimer timer) Wrap an output stream with a timeout on all write operations.
| |
| beginWrite | back to summary |
|---|---|
| private void beginWrite() | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| endWrite | back to summary |
|---|---|
| private void endWrite() | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes
to be written out. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| getTimeout | back to summary |
|---|---|
| public int getTimeout() Get number of milliseconds before aborting a write.
| |
| setTimeout | back to summary |
|---|---|
| public void setTimeout(int millis) Set number of milliseconds before aborting a write.
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf, int off, int len) throws IOException Overrides java. Doc from java. Writes
If
If
| |
| writeTimedOut | back to summary |
|---|---|
| private InterruptedIOException writeTimedOut(InterruptedIOException cause) | |