| java.lang.Object | ||
| ↳ | java.io.Writer | |
| ↳ | java.io.PipedWriter | |
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 
            PipedWriterconnected todestination. | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  | 
           Closes this writer.
           | ||||||||||
|  | 
           Connects this 
            PipedWriterto aPipedReader. | ||||||||||
|  | 
           Notifies the readers of this 
            PipedReaderthat characters can be read. | ||||||||||
|  | 
           Writes 
            countcharacters from the character arraybufferstarting at offsetindexto this writer. | ||||||||||
|  | 
           Writes a single character 
            cto this writer. | ||||||||||
| [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 writer must be connected to a PipedReader before data may be written to it.
Constructs a new PipedWriter connected to destination. Any data written to this writer can be read from destination.
| destination | the PipedReaderto connect to. | 
|---|
| IOException | if destinationis already connected. | 
|---|
Closes this writer. If a PipedReader is connected to this writer, it is closed as well and the pipe is disconnected. Any data buffered in the reader can still be read.
| IOException | if an error occurs while closing this writer. | 
|---|
Connects this PipedWriter to a PipedReader. Any data written to this writer becomes readable in the reader.
| reader | the reader to connect to. | 
|---|
| IOException | if this writer is closed or already connected, or if readeris already connected. | 
|---|
Notifies the readers of this PipedReader that characters can be read. This method does nothing if this Writer is not connected.
| IOException | if an I/O error occurs while flushing this writer. | 
|---|
Writes count characters from the character array buffer starting at offset index to this writer. The written data can then be read from the connected PipedReader instance. 
 Separate threads should be used to write to a PipedWriter and to read from the connected PipedReader. If the same thread is used, a deadlock may occur.
| buffer | the buffer to write. | 
|---|---|
| offset | the index of the first character in bufferto write. | 
| count | the number of characters from bufferto write to this writer. | 
| IndexOutOfBoundsException | if offset < 0orcount < 0, or ifoffset + countis bigger than the length ofbuffer. | 
|---|---|
| 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. | 
| IOException | if this writer is closed or not connected, if the target reader is closed or if the thread reading from the target reader is no longer alive. This case is currently not handled correctly. | 
| NullPointerException | if bufferisnull. | 
Writes a single character c to this writer. This character can then be read from the connected PipedReader instance. 
 Separate threads should be used to write to a PipedWriter and to read from the connected PipedReader. If the same thread is used, a deadlock may occur.
| c | the character to write. | 
|---|
| 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. | 
|---|---|
| IOException | if this writer is closed or not connected, if the target reader is closed or if the thread reading from the target reader is no longer alive. This case is currently not handled correctly. |