java.io.PipedWriter
java.io.Writer
None
None
New as of JDK 1.1
The PipedWriter class represents half of a communication pipe; a PipedReader must be connected to a PipedWriter. When the two halves of a communication pipe are connected, data written to the PipedWriter can be read from the PipedReader. The communication pipe formed by a PipedWriter and a PipedReader should be used to communicate between threads. If both ends of a pipe are used by the same thread, the thread can hang.
The PipedWriter class is the character-based equivalent of the byte-based PipedOutputStream.
public class java.io.PipedWriter extends java.io.Writer { // Constructors public PipedWriter(); public PipedWriter(PipedReader sink); // Instance Methods public void close(); public void connect(PipedReader sink); public void flush(); public void write(char[] cbuf, int off, int len; }
This constructor creates a PipedWriter that is not connected to a PipedReader. The created object must be connected to a PipedReader before it can be used.
The PipedReader to connect.
If any kind of I/O error occurs.
This constructor creates a PipedWriter that sends data to the given PipedReader.
If any kind of I/O error occurs.
Writer.close()
This method closes the writer and releases the system resources that are associated with it.
The PipedReader to connect.
If another PipedReader is already connected to this PipedWriter or this PipedWriter is already connected.
This method connects this PipedWriter object to the given PipedReader. If this PipedWriter or sink is already connected, an exception is thrown.
If any kind of I/O error occurs.
While this method is waiting for buffer space to become available, if the interrupted() method of the thread that invoked this method is called.
Writer.flush()
This method flushes the writer, which tells the connected PipedReader to notify its readers to read any available data.
public void write(char[] cbuf, int off, int len) throws IOException
An array of characters to write to the stream.
An offset into the character array.
The number of characters to write.
If any kind of I/O error occurs.
Writer.write(char[], int, int)
This method writes len characters of output from the given array, starting at offset off. The method passes the given data to the connected PipedReader.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
write(int) |
Writer |
write(char[]) |
Writer |
write(String) |
Writer |
write(String, int, int) |
Writer |
IOException, PipedOutputStream, PipedReader, Writer
This HTML Help has been published using the chm2web software. |