Hi i am trying to read an image that resides somewhere on the web from my Java program. So far i have successfully loaded an image by using the following code.
URL url = new URL("http://www.google.com/images/nav_logo4.png");
Image img = Toolkit.getDefaultToolkit().getImage(url);
What i want to know is why this code (which is the first i tried) does not work :
BufferedImage img = ImageIO.read(new File("http://www.google.com/images/nav_logo4.png));
This would have the benefit of giving me a Buffered image. Also how can i make the above code block until the image is loaded. I know i can use an image observer but is there a simpler way?
When i try the second option i get this exception :
javax.imageio.IIOException: Can't read input file!