See OutputStream class for descriptions of the methods PipedOutputStream can use. They are:
write( int b ) Writes a single byte, supplied as the low-order byte in an int.
write( byte[ ] ) Writes an array of bytes.
write( byte[ ], offset, len ) Writes
a portion len of a byte
array, beginning at offset
close( ) Closes the stream, flushing it first.
flush( ) Flushes all associated buffers in a stream without closing it.
plus it adds:
.connect(...) Below
See also pipes, PipedReader class .
■ PipedOutputStream provides
a byte output stream which always writes into an associated PipedInputStream to which it is
connected.
■ PipedWriter has implementations of the five basic methods from OutputStream. see OutputStream class for examples of those methods
■ PipedOutputStream adds one method to OutputStream:
void .connect( PipedInputStream
) method
This causes the PipedOutputStream to be connected to the PipedInputStream which will read the PipedOutputStream 's data.
pos.connect( pis ); achieves the same connection result as the constructor statement below:
PipedOutputStream pos = new PipedOutputStream( pis
);
■ You cannot write to a PipedOutputStream until a PipedInputStream is connected.
■ Code examples to illustrate the use of PipedOutputStream are not provided here because they are directly similar to those provided for PipedWriter in the the pipes explanation. See pipes and simply substitute the byte streams for the character streams demonstrated there.