PipedReader class methods in Java

java.io.PipedReader

Piped character-input streams.

The PipedReader class is used to read the contents of a pipe as a stream of characters. This class is used generally to read text. PipedReader class must be connected to the same PipedWriter and are used by different threads.

Implemented Interfaces: 

Closeable, AutoCloseable, Readable

Some methods of PipedReader class

close(): This method Closes this piped stream and releases any system resources associated with the stream.

connect(PipedWriter): This method causes this piped reader to be connected to the piped writer src.

PipedReader(): This method creates a PipedReader so that it is not yet connected. It must be connected to a PipedWriter before being used.

PipedReader(int):  This method creates a PipedReader so that it is not yet connected and uses a specified pipe size for the pipe's buffer.

PipedReader(PipedWriter): This method creates a PipedReader so that it is connected to the piped writer src.

PipedReader(PipedWriter, int): This method creates a PipedReader so that it is connected to the piped writer src and uses the specified pipe size for the pipe's buffer.

read(): This method reads the next character of data from this piped stream.

read(char[], int, int): This method reads up to len characters of data from this piped stream into an array of characters.

ready(): This method tells whether this stream is ready to be read.

No comments:

Post a Comment