Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ImageIO.read() timeout?

 
Brendan Griffin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using ImageIO to read an image from a URL as follows:


However I am finding on some occasions this hangs and never times out or throws a error but doesnt complete so it is hanging my program.
Is there any way to set it to timeout after a certain length of time?

I have checked the urls that i am using through a web browser and they do exist but can be slow to display the picture.

Thanks!
 
Kiaamaa Liammes
Ranch Hand
Posts: 32
Eclipse IDE Java Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you specify the Java version you are using , Java 1.6 has a more efficient image I/O
 
Campbell Ritchie
Sheriff
Pie
Posts: 50241
79
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
Brendan Griffin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kiaamaa Liammes wrote:Can you specify the Java version you are using , Java 1.6 has a more efficient image I/O


Java 1.5. Cant use 1.6 for this program unfortunately. Is there another mechanism that I can use that will give more control over timeouts?

Seeing as i'm asking about ImageIO...I am unsing it to get the image from a url. I then convert it to a byte[] to store in a db blob. Am i doing it correctly?
 
Kiaamaa Liammes
Ranch Hand
Posts: 32
Eclipse IDE Java Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found a similar bug in JDK JDK Bug
 
Maneesh Godbole
Saloon Keeper
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to check out MediaTracker
 
Brendan Griffin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:You might want to check out MediaTracker


that looks like a much messier way..would have to implement it in a class that extends a java.awt.Component and then have to go in to complex Image to BufferedImage conversion. might have to though...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic