Forums Register Login

Read a file from net!

+Pie Number of slices to send: Send
I just whant to read a file from net. It should be simple but it's not working. Here is my code:

Every time I get an exeception.
It's because the string ("http://www.somePage.com\\index.html"), because servers security or the code is just wrong? If you can please tell me some other ways of dooing this "Reading". If it's important, I whant do use it at an "update module" of one of my softs i'm working at. All this module has to do is to replace some existing files whit some new ones from the net.
Thank you in advance!
+Pie Number of slices to send: Send
Hi,
I think the below code will work fine. Its working fine at my end.
try {
URL url = new URL("http://www.somesite.com/eng/index.htm");
DataInputStream in = new DataInputStream(url.openStream());
//reading from in.....}catch(Exception e){ System.out.println("ERROR!");}
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 729 times.
Similar Threads
bufferedreader
URLs
Your favorite ORM Tool and Why?
Problems with aJAR file built using one-jar
Need help with FileChannel
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:02:15.