Results 1 to 1 of 1
Thread: JPEGCodec and ImageIO
- 12-14-2011, 02:57 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 7
- Rep Power
- 0
JPEGCodec and ImageIO
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)
and this works with no problem (I read 3 lines before it and 1 after)Java Code:BI = JPEGCodec.createJPEGDecoder(dis).decodeAsBufferedImage();
When I change it to
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).Java Code:BI = ImageIO.read(dis);
Why? how to make it work?
2. The second question is about:
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?Java Code:BI = JPEGCodec.createJPEGDecoder(dis).decodeAsBufferedImage();
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
Similar Threads
-
ImageIO exception problem
By jammas615 in forum New To JavaReplies: 4Last Post: 07-06-2011, 11:52 AM -
Error with ImageIO
By stegano in forum New To JavaReplies: 4Last Post: 03-31-2011, 03:59 PM -
BufferedImage, ImageIO and Jar files
By satory in forum New To JavaReplies: 6Last Post: 05-23-2010, 12:07 AM -
Trouble with ImageIO
By sari in forum New To JavaReplies: 1Last Post: 03-30-2009, 09:42 PM -
Help with ImageIO
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks