Hi guys
I have two questions to ask:
1. How to migrate from JPEGCodec do ImageIO?
I'm reading now from a url camera to an BufferedImage (dis = dataImputStream)
Java Code:
BI = JPEGCodec.createJPEGDecoder(dis).decodeAsBufferedImage();
and this works with no problem (I read 3 lines before it and 1 after)
When I change it to
Java Code:
BI = ImageIO.read(dis);
only the firt JPEG is read, after that the afterword line reads a fragment of JPG (I don't know if it's the firts or the second JPEG).
Why? how to make it work?

2. The second question is about:
Java Code:
BI = JPEGCodec.createJPEGDecoder(dis).decodeAsBufferedImage();
I read this in a never ending loop while(true) in a new thread and it work perfectly. But if the communication is broken for a longer while (when it's bad for a short time maybe for 5 seconds it's ok - I've made some try'es and catch'es and it comes back) it doesn't run after it's back. It stops on the line shown on the top. I think java suspends the thread after some time when the stream is stacked? An I right?
Is there a method to add a timeout to prevent from thread suspension? I've tried url.setTimeout... but it didn't help at all.

Thanks for help