FileDocCategorySizeDatePackage
Browser0.javaAPI DocExample947Sat Nov 25 12:54:06 GMT 2000None

Browser0

public class Browser0 extends Object
Browser0 - Get the contents of a URL, write to stdout

Fields Summary
Constructors Summary
Browser0(String[] av)

		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);
	
Methods Summary
public static voidmain(java.lang.String[] av)

		new Browser0(av);