Re: Java Newbie... Read file at HTTP
- From: Lloyd Duke <news@xxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 00:48:15 GMT
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 .
- Follow-Ups:
- Re: Java Newbie... Read file at HTTP
- From: sven . dz
- Re: Java Newbie... Read file at HTTP
- References:
- Java Newbie... Read file at HTTP
- From: sven . dz
- Re: Java Newbie... Read file at HTTP
- From: Lloyd Duke
- Java Newbie... Read file at HTTP
- Prev by Date: Re: Java Newbie... Read file at HTTP
- Next by Date: Re: the right way to kill a java thread on Windows?
- Previous by thread: Re: Java Newbie... Read file at HTTP
- Next by thread: Re: Java Newbie... Read file at HTTP
- Index(es):