Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.io

Class PipedWriter

java.lang.Object
|
+--java.io.Writer
   |
   +--java.io.PipedWriter


public class PipedWriter

extends Writer

This class writes its chars to a PipedReader to which it is connected.

It is highly recommended that a PipedWriter and its connected PipedReader be in different threads. If they are in the same thread, read and write operations could deadlock the thread.

Author:

Constructor Summary

PipedWriter()

Create an unconnected PipedWriter.
PipedWriter(java.io.PipedReader sink)

Create a new PipedWriter instance to write to the specified PipedReader.

Method Summary

voidclose()

This method closes this stream so that no more data can be written to it.
voidconnect(java.io.PipedReader sink)

Connects this object to the specified PipedReader object.
voidflush()

This method does nothing.
voidwrite(int b)

Write a single char of date to the stream.
voidwrite(char[] b, int off, int len)

This method writes len chars of data from the char array buf starting at index offset in the array to the stream.

Constructor Details

PipedWriter

public PipedWriter()

Create an unconnected PipedWriter. It must be connected to a PipedReader using the connect method prior to writing any data or an exception will be thrown.


PipedWriter

public PipedWriter(java.io.PipedReader sink)

Create a new PipedWriter instance to write to the specified PipedReader. This stream is then ready for writing.

Parameters:

Throws:


Method Details

close

public void close()

This method closes this stream so that no more data can be written to it. Any further attempts to write to this stream may throw an exception

Throws:


connect

public void connect(java.io.PipedReader sink)

Connects this object to the specified PipedReader object. This stream will then be ready for writing.

Parameters:

Throws:


flush

public void flush()

This method does nothing.

Throws:


write

public void write(char[] b, int off, int len)

This method writes len chars of data from the char array buf starting at index offset in the array to the stream. Note that this method will block if the PipedReader to which this object is connected has a buffer that cannot hold all of the chars to be written.

Parameters:

Throws:


write

public void write(int b)

Write a single char of date to the stream. Note that this method will block if the PipedReader to which this object is connected has a full buffer.

Parameters:

Throws: