/*
*/
import java.net.*;
import java.io.*;
/*
* This example illustrates using a URL to access resources
* on a secure site.
*
* If you are running inside a firewall, please also set the following
* Java system properties to the appropriate value:
*
* http.proxyHost =
* http.proxyPort =
*
* https.proxyHost =
* https.proxyPort =
*/
public class URLReader {
public static void main(String[] args) throws Exception {
String inputLine;
String urlstring;
urlstring="";
if (args.length < 1) {
System.out.println(
"USAGE: java URLReader " +
"URL");
System.exit(-1);
}
try {
urlstring = args[0];
} catch (IllegalArgumentException e) {
System.out.println("USAGE: java URLReader " +
"URL");
System.exit(-1);
}
URL myurl = new URL(urlstring);
BufferedReader in = new BufferedReader(
new InputStreamReader(
myurl.openStream()));
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}