Piped I/O

Piped I/O provides the capability for threads to communicate via streams. A thread sends data to another thread by creating an object of PipedOutputStream that it connects to an object of PipedInputStream. The output data written by one thread is read by another thread using the PipedInputStream object.

The process of connecting piped input and output threads is symmetric. An object of class PipedInputThread can also be connected to an existing object of class PipedOutputThread.

Java automatically performs synchronization with respect to piped input and output streams. The thread that reads from an input pipe does not have to worry about conflicts with tasks that are being written to the corresponding output stream thread.

Both PipedInputStream ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.