|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.PipedOutputStream
public class PipedOutputStream
PipedOutputStream is a class which places information on a communications pipe. When two threads want to pass data back and forth, one creates a piped output stream and the other creates a piped input stream.
PipedInputStream| Constructor Summary | |
|---|---|
PipedOutputStream()
Constructs a new unconnected PipedOutputStream. |
|
PipedOutputStream(PipedInputStream dest)
Constructs a new PipedOutputStream connected to the PipedInputStream dest. |
|
| Method Summary | |
|---|---|
void |
close()
Close this PipedOutputStream. |
void |
connect(PipedInputStream stream)
Connects this PipedOutputStream to a PipedInputStream. |
void |
flush()
Notifies the readers on the PipedInputStream that bytes can be read. |
void |
write(byte[] buffer,
int offset,
int count)
Writes count bytes from this byte array
buffer starting at offset index to this
PipedOutputStream. |
void |
write(int oneByte)
Writes the specified byte oneByte to this
PipedOutputStream. |
| 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 PipedOutputStream()
public PipedOutputStream(PipedInputStream dest)
throws IOException
dest. Any data written to this stream can be read from
the dest.
dest - the PipedInputStream to connect to.
IOException - if dest is already connected.| Method Detail |
|---|
public void close()
throws IOException
close in interface Closeableclose in class OutputStreamIOException - If an error occurs attempting to close this
PipedOutputStream.
public void connect(PipedInputStream stream)
throws IOException
stream - the destination PipedInputStream.
IOException - If this Stream or the dest is already connected.
public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException - If an IO error occurs during the flush.
public void write(byte[] buffer,
int offset,
int count)
throws IOException
count bytes from this byte array
buffer starting at offset index to this
PipedOutputStream. The written data can now be read from the destination
PipedInputStream. Separate threads should be used for the reader of the
PipedInputStream and the PipedOutputStream. There may be undesirable
results if more than one Thread interacts a input or output pipe.
write in class OutputStreambuffer - the buffer to be writtenoffset - offset in buffer to get bytescount - number of bytes in buffer to write
IOException - If the receiving thread was terminated without closing the
pipe. This case is not currently handled correctly.
InterruptedIOException - If the pipe is full and the current thread is interrupted
waiting for space to write data. This case is not currently
handled correctly.
NullPointerException - If the receiver has not been connected yet.
IllegalArgumentException - If any of the arguments are out of bounds.
public void write(int oneByte)
throws IOException
oneByte to this
PipedOutputStream. Only the low order byte of oneByte is
written. The data can now be read from the destination PipedInputStream.
Separate threads should be used for the reader of the PipedInputStream
and the PipedOutputStream. There may be undesirable results if more than
one Thread interacts a input or output pipe.
write in class OutputStreamoneByte - the byte to be written
IOException - If the receiving thread was terminated without closing the
pipe. This case is not currently handled correctly.
InterruptedIOException - If the pipe is full and the current thread is interrupted
waiting for space to write data. This case is not currently
handled correctly.
NullPointerException - If the receiver has not been connected yet.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||