■ PipedWriter provides a character output stream which always writes its characters into an associated PipedReader to which it is connected.
■ PipedWriter has implementations of all the methods from Writer. see Writer class. They are:
.close( ) Closes the stream, flushing it first.
.flush( ) Flushes all associated buffers in a stream without closing it.
.write( int c ) Writes a single char, supplied as the low-order two bytes of a four-byte int.
.write( char[ ] c ) Writes an array of characters.
.write( char[ ] c, int off, int len ) Writes a portion len of a character array, beginning at offset
.write( String s ) Writes a String.
.write( String s, int off, int len ) Writes a portion len of a String, beginning at off
.connect( PipedReader ) below
■ PipedWriter adds one method to those from Writer:
This causes the PipedWriter to be connected to the PipedReader which will read the PipedWriter's data.
Using pw.connect( pr ); achieves the same connection result as this constructor statement:
PipedWriter pw = new PipedWriter( pr );
■ You cannot write to a PipedWriter until a PipedReader is connected to it - one way or the other. Use either the method or the constructor to make the connection.
■ Some examples illustrating the use of PipedWriter are provided under the pipes explanation. see pipes