Results 1 to 6 of 6
Thread: Loading files via HTTP
- 11-03-2009, 07:49 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 3
- Rep Power
- 0
- 11-03-2009, 08:00 PM #2
apache commons-httpclient ?
- 11-03-2009, 08:03 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 3
- Rep Power
- 0
Well, probably you are right, but I'm sure it could be done by means of pure java... what I asks should be quite simple, some standard j2se class should provide this...
- 11-03-2009, 08:24 PM #4
How about something like this?
Java Code:try { java.net.URL url = new java.net.URL("http://www.mywebsite.com/someplace/test.txt"); InputStreamReader inStream = new InputStreamReader(url.openStream()); BufferedReader in = new BufferedReader(inStream); String line = in.readLine(); while(line!=null) { System.out.println(line); line = in.readLine(); } inStream.close(); } catch(Exception e) { e.printStackTrace(); }My Hobby Project: LegacyClone
- 11-03-2009, 08:30 PM #5
Member
- Join Date
- Nov 2009
- Posts
- 3
- Rep Power
- 0
Thanks mrmatt1111!
Two questions:
1. Will it work if I mention in URL path on my local PC like "C:\example\file.txt"?
2. Will it be still HTTP used during file loading?
- 11-03-2009, 08:34 PM #6
Java Code:java.net.URL url = new java.net.URL("file:///c:/example/file.txt");Last edited by mrmatt1111; 11-03-2009 at 08:37 PM.
My Hobby Project: LegacyClone
Similar Threads
-
loading files contained within app jar file
By thorne_ in forum New To JavaReplies: 3Last Post: 05-18-2009, 02:26 PM -
Uploading files to server via HTTP
By dan0 in forum New To JavaReplies: 2Last Post: 03-13-2009, 06:27 PM -
Transfering files over HTTP
By DannyZB in forum NetworkingReplies: 16Last Post: 11-09-2008, 09:50 PM -
loading flash files in linux
By rajeshang in forum AWT / SwingReplies: 0Last Post: 05-31-2008, 01:59 PM -
External JavaScript files not loading
By sajut in forum New To JavaReplies: 0Last Post: 02-15-2008, 05:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks