Loading files via HTTP
I need to load files via HTTP protocol in my app. Could you tell me which classes of which java package should I use? I need to load files from local PC (no URL). I read javadoc for java.io.* but I didn't notice any word concerning 'http' there...
apache commons-httpclient ?
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...
How about something like this?
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();
line = in.readLine();
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?
java.net.URL url = new java.net.URL("file:///c:/example/file.txt");