Javatpoint Logo
Javatpoint Logo

Java - PipedWriter

The PipedWriter class is used to write java pipe as a stream of characters. This class is used generally for writing text. Generally PipedWriter is connected to a PipedReader and used by different threads.

Constructor

Constructor Description
PipedWriter() It creates a piped writer that is not yet connected to a piped reader.
PipedWriter(PipedReader snk) It creates a piped writer connected to the specified piped reader.

Method

Modifier and Type Method Method
void close() It closes this piped output stream and releases any system resources associated with this stream.
void connect(PipedReader snk) It connects this piped writer to a receiver.
void flush() It flushes this output stream and forces any buffered output characters to be written out.
void write(char[] cbuf, int off, int len) It writes len characters from the specified character array starting at offset off to this piped output stream.
void write(int c) It writes the specified char to the piped output stream.

Example

Output:

I love my country





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA