The PipedInputStream and PipedOutputStream classes can be used to read and write data simultaneously. Both streams are connected with each other using the connect() method of the PipedOutputStream class.
Example of PipedInputStream and PipedOutputStream classes using threads
Here, we have created two threads t1 and t2. The t1 thread writes the data using the PipedOutputStream object and the t2thread reads the data from that pipe using the PipedInputStream object. Both the piped stream object are connected with each other.
No comments:
Post a Comment