June 2004
Intermediate to advanced
848 pages
21h 28m
English
A pipe is an easy way to move data between two threads. One thread writes into the pipe, and the other reads from it. This forms a producer/consumer buffer, ready-programmed for you! There are two stream classes that we always use together in a matched consumer/producer pair:
PipedInputStream –. Gets bytes from a pipe (think “hosepipe”; it's just a data structure that squirts bytes at you).
PipedOutputStream –. Puts bytes into a pipe (think “drainpipe”; it's just a data structure that drinks down bytes that you pour into it).
An object of one of these classes is connected to an object of the other class, providing a safe way (without data race conditions) for one thread to send a stream of data to another thread. ...
Read now
Unlock full access