PipedOutputStream class methods in Java

java.io.PipedOutputStream

A piped output stream can be connected to a piped input stream to create a communications pipe. The piped output stream is the sending end of the pipe.

Typically, data is written to a PipedOutputStream object by one thread and data is read from the connected PipedInputStream by some other thread.

Attempting to use both objects from a single thread is not recommended as it may deadlock the thread. The pipe is said to be broken if a thread that was reading data bytes from the connected piped input stream is no longer alive.

Implemented Interfaces:

Closeable, Flushable, AutoCloseable

Some methods of PipedOutputStream class

close()This method closes this piped output stream and releases any system resources associated with this stream.

connect(PipedInputStream)This method connects this piped output stream to a receiver.

flush()This method flushes this output stream and forces any buffered output by the test to be written out.

PipedOutputStream()This method creates a piped output stream that is not yet connected to a piped input stream.

PipedOutputStream(PipedInputStream)This method creates a piped output stream connected to the specified piped input stream.

write(int)This method writes the specified byte to the piped output stream.

write(byte[], int, int)This method writes len bytes from the specified byte array starting at offset off to this piped output stream.

No comments:

Post a Comment