Monday, 26 August 2013

Connecting an InputStream to an OutputStream

Connecting an InputStream to an OutputStream

I have a Runnable class with input and output streams for read/write. I
want to create two thread of this Runnable and connect one's InputStream
to other's OutputStream.
this is what I use:
PipedInputStream pin = new PipedInputStream();
PipedOutputStream pout = new PipedOutputStream(pin);
r1.setInputStream(pin);
r2.setOutputStream(pout);
is there any better solution?

No comments:

Post a Comment