FileDocCategorySizeDatePackage
TextBrowser.javaAPI DocExample1012Sat Nov 25 12:55:56 GMT 2000None

TextBrowser

public class TextBrowser extends Object
TextBrowser - URL/text mode getter. Display the contents of a text-only URL
author
Ian Darwin, ian@darwinsys.com

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)

		TextBrowser tb = new TextBrowser();
		if (av.length == 0) {
			System.err.println("Usage: TextBrowser URL [...]");
			System.exit(1);
		}
		else for (int i=0; i<av.length; i++) {
			tb.showDocument(av[i]);
		}
	
protected voidshowDocument(java.lang.String loc)
Show one document, by filename

		URL webURL = null;
		try {
			System.err.println("*** Loading " + loc + "... ***");
			webURL = new URL(loc);
			BufferedReader is = new BufferedReader(
				new InputStreamReader(webURL.openStream()));
			String line;
			while ((line = is.readLine()) != null) {
				System.out.println(line);
			}
			is.close();
		} catch (MalformedURLException e) {
			System.err.println("Load failed: " + e);
		} catch (IOException e) {
			System.err.println("IOException: " + e);
		}