| java.lang.Object java.io.Writer java.io.PipedWriter
PipedWriter | public class PipedWriter extends Writer (Code) | | PipedWriter is a class which places information on a communications pipe.
When two threads want to pass data back and forth, one creates a piped writer
and the other creates a piped reader.
See Also: PipedReader |
Constructor Summary | |
public | PipedWriter() Constructs a new unconnected PipedWriter. | public | PipedWriter(PipedReader dest) Constructs a new PipedWriter connected to the PipedReader
dest . |
Method Summary | |
public void | close() Close this PipedWriter. | public void | connect(PipedReader stream) Connects this PipedWriter to a PipedReader. | public void | flush() Notifies the readers on the PipedReader that characters can be read. | public void | write(char buffer, int offset, int count) Writes count chars from the char array
buffer starting at offset index to this
PipedWriter. | public void | write(int c) Writes the character c to this PipedWriter. |
PipedWriter | public PipedWriter()(Code) | | Constructs a new unconnected PipedWriter. The resulting Stream must be
connected to a PipedReader before data may be written to it.
|
PipedWriter | public PipedWriter(PipedReader dest) throws IOException(Code) | | Constructs a new PipedWriter connected to the PipedReader
dest . Any data written to this Writer can be read from
the dest .
Parameters: dest - the PipedReader to connect to. throws: java.io.IOException - if dest is already connected. |
close | public void close() throws IOException(Code) | | Close this PipedWriter. Any data buffered in the corresponding
PipedReader can be read, then -1 will be returned to the reader. If this
Writer is not connected, this method does nothing.
throws: java.io.IOException - If an error occurs attempting to close this PipedWriter. |
connect | public void connect(PipedReader stream) throws IOException(Code) | | Connects this PipedWriter to a PipedReader. Any data written to this
Writer becomes readable in the Reader.
Parameters: stream - the destination PipedReader. throws: java.io.IOException - If this Writer or the dest is already connected. |
flush | public void flush() throws IOException(Code) | | Notifies the readers on the PipedReader that characters can be read. This
method does nothing if this Writer is not connected.
throws: java.io.IOException - If an IO error occurs during the flush. |
write | public void write(char buffer, int offset, int count) throws IOException(Code) | | Writes count chars from the char array
buffer starting at offset index to this
PipedWriter. The written data can now be read from the destination
PipedReader. Separate threads should be used for the reader of the
PipedReader and the PipedWriter. There may be undesirable results if more
than one Thread interacts a input or output pipe.
Parameters: buffer - the buffer to be written Parameters: offset - offset in buffer to get chars Parameters: count - number of chars in buffer to write throws: java.io.IOException - If the receiving thread was terminated without closing thepipe. This case is not currently handled correctly. throws: java.io.InterruptedIOException - If the pipe is full and the current thread is interruptedwaiting for space to write data. This case is not currentlyhandled correctly. throws: java.lang.NullPointerException - If the receiver has not been connected yet. throws: java.lang.IllegalArgumentException - If any of the arguments are out of bounds. |
write | public void write(int c) throws IOException(Code) | | Writes the character c to this PipedWriter. The written
data can now be read from the destination PipedReader. Separate threads
should be used for the reader of the PipedReader and the PipedWriter.
There may be undesirable results if more than one Thread interacts a
input or output pipe.
Parameters: c - the character to be written throws: java.io.IOException - If the receiving thread was terminated without closing thepipe. This case is not currently handled correctly. throws: java.io.InterruptedIOException - If the pipe is full and the current thread is interruptedwaiting for space to write data. This case is not currentlyhandled correctly. throws: java.lang.NullPointerException - If the receiver has not been connected yet. |
|
|