Re: Java Newbie... Read file at HTTP



OOPS!
sorry cut and paste got the best of me :-(

that second part should read

If you need just a file over HTTP:

URL image = new URL(urlForXYZ.com, "pic.jpg");
URLConnection con = image.openConnection();
con.setDoInput(true);
con.setUseCaches(false);
InputStream stream = con.getInputStream();
....
	do something with the stream
stream.close();
con.close();


Lloyd Duke wrote:
How do you mean *load*?
If you want an image:

BufferedImage bi = ImageIO.read(urlForXYZ.com);
you then have the image.

If you need just a file over HTTP:

URL image = new URL(urlForXYZ.com, pic.jpg);
URLConnection con = getImages.openConnection();
con.setDoInput(true);
con.setUseCaches(false);
InputStream stream = con.getInputStream();
...
    do something with the stream
stream.close();
con.close();


sven.dz@xxxxxxxxx wrote:

Hi,

I need the code for "loading" a picture over www (ex.
http://www.xyz.com/pic.jpg). I need only to load it, I do not need to
save it on my disk or something like that... Sounds useless and it
is... But I want to learn it and I need it :-)

Greetings



-- http://lloyd-duke.net + news AT website.domain .