| java.lang.Object | ||
| ↳ | java.io.Writer | |
| ↳ | java.io.PipedWriter | |
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.
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.Writer
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new unconnected PipedWriter.
| |||||||||||
Constructs a new PipedWriter connected to the PipedReader
dest. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Close this PipedWriter.
| |||||||||||
Connects this PipedWriter to a PipedReader.
| |||||||||||
Notifies the readers on the PipedReader that characters can be read.
| |||||||||||
Writes
count chars from the char array
buffer starting at offset index to this
PipedWriter. | |||||||||||
Writes the character
c to this PipedWriter. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.Writer
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
From interface java.io.Flushable
| |||||||||||
From interface java.lang.Appendable
| |||||||||||
Constructs a new unconnected PipedWriter. The resulting Stream must be connected to a PipedReader before data may be written to it.
Constructs a new PipedWriter connected to the PipedReader
dest. Any data written to this Writer can be read from
the dest.
| dest | the PipedReader to connect to. |
|---|
| IOException | if dest is already connected.
|
|---|
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.
| IOException | If an error occurs attempting to close this PipedWriter. |
|---|
Connects this PipedWriter to a PipedReader. Any data written to this Writer becomes readable in the Reader.
| stream | the destination PipedReader. |
|---|
| IOException | If this Writer or the dest is already connected. |
|---|
Notifies the readers on the PipedReader that characters can be read. This method does nothing if this Writer is not connected.
| IOException | If an IO error occurs during the flush. |
|---|
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.
| buffer | the buffer to be written |
|---|---|
| offset | offset in buffer to get chars |
| count | number of chars 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. |
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.
| c | the character 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. |