Using JTidy in threads with piped IO streams

G'day,

I'm currently working on a problem with JTidy and threads. Just the simple
producer-consumer example; I created two threads and let the first one
parse an URL stream with JTidy and write to an output stream, while the
other one reads this output from an input stream. I used the classes
PipedInputStream and PipedOutputStream to connect the two of them.
However, this won't work. The input stream connected to the outputstream
(the latter should be written by JTidy) doesn't seem to contain any data,
as I checked using its "available()" method. Outputting to a file e.g.
works perfectly; so it's not a reason of the original URL stream.
Sometimes it seems there's no data available, sometimes nothing happens as
if the threads were deadlocking each other. I tried as much as I could,
but nothing worked unfortunately.
Maybe someone has an idea of how to solve that problem, or even some
sample code to throw a glance at.

Any help is much appreciated.

Cheers,
Armin

--
< Armin Braun
< Karlsruhe University of Applied Sciences
< brar0013@fh-karlsruhe.de

Received on Monday, 10 June 2002 11:01:09 UTC