|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.mindbright.util.OutputStreamPipe
public final class OutputStreamPipe
An output stream pipe should be connected to an input stream pipe;
the input stream pipe then provides whatever data bytes are
written to the output stream pipe. This is very close to the
PipedInputStream
and
PipedOutputStream
. The main difference is that there
is a timeout in the write code so that any waiting write will be
aborted if the pipe is closed.
The input and output pipes are connected via a circular buffer which decouples write and read operations.
InputStreamPipe
,
PipedInputStream
,
PipedOutputStream
Constructor Summary | |
---|---|
OutputStreamPipe()
Create an OutputStreamPipe which is not connected to any InputStreamPipe. |
|
OutputStreamPipe(InputStreamPipe sink)
Create an OutputStreamPipe which is connected to the given InputStreamPipe. |
Method Summary | |
---|---|
void |
close()
Close this output stream pipe. |
void |
connect(InputStreamPipe sink)
Connect this pipe to an InputStreamPipe |
void |
flush()
Notify all instances waiting on this stream. |
void |
write(byte[] buf,
int off,
int len)
Put data into this output stream pipe. |
void |
write(int b)
Writes a byte of data into this output stream pipe. |
Methods inherited from class java.io.OutputStream |
---|
write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OutputStreamPipe(InputStreamPipe sink) throws java.io.IOException
sink
- pipe to connect to
java.io.IOException
public OutputStreamPipe()
Method Detail |
---|
public void connect(InputStreamPipe sink) throws java.io.IOException
sink
- pipe to connect to
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte of data to write
java.io.IOException
public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
buf
- array holding data to putoff
- offset of first byte to putlen
- number of bytes to put
java.io.IOException
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |