Double streams



Hello.

Having an issue with double streams... for a lack of a better name. :)

I have the following two streams:
- FooInputStream, fis, extending InputStream
- FooOutputStream, fos, extending OutputStream

These each have a piped stream as a local variable, so:
- fos has a PipedOutputStream, pos
- fis has a PipedInputStream, pis

So pis and pos are initalized and connected, and are passed to fis and fos, respectively.

What i wanted to do was write to fos, which would then delegate the call to pos, and then i could read from fis, which would read from pis. So the writes are fine, and the read in pis returns fine, but then it just seems to hang. If i close any of the ouputstreams, it returns, and everything is fine. But then i can't use the outputstreams, and i need to do that.

Can any explain what's going on? Maybe a push in the right direction as to how to solve it?

Regards,
Carsten H. Pedersen
.