String loc = null;
String data = null;
switch(av.length) {
case 0: loc = "http://localhost/"; break;
case 1: loc = av[0]; break;
default:
System.err.println("Usage: getFromURL [url]");
System.exit(1);
}
try {
URL Web = new URL(loc);
BufferedReader is = new BufferedReader(
new InputStreamReader(
Web.openStream()));
String line;
while ((line = is.readLine()) != null)
System.out.println(line);
is.close();
} catch (MalformedURLException e) {
System.out.println("MalformedURLException: " + e);
} catch (IOException e) {
System.out.println("IOException: " + e);
}
if (data != null)
System.out.println("Data " + data);