FileDocCategorySizeDatePackage
viewsource2.javaAPI DocExample1040Thu Apr 03 15:26:54 BST 1997None

viewsource2

public class viewsource2 extends Object

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


    String thisLine;
    URL u;
    URLConnection uc;

    if  (args.length > 0) {

      //Open the URL for reading
      try {
        u = new URL(args[0]);
        try {
          uc = u.openConnection();

          // now turn the URLConnection into a DataInputStream
          DataInputStream theHTML = new DataInputStream(uc.getInputStream());

          try {
            while ((thisLine = theHTML.readLine()) != null) {
              System.out.println(thisLine);
            } // while loop ends here
          }  // end try
          catch (Exception e) {
            System.err.println(e);
          }
        } // end try
        catch (Exception e) {
          System.err.println(e);
        }

      } // end try
      catch (MalformedURLException e) {
        System.err.println(args[0] + " is not a parseable URL");
        System.err.println(e);
      }
    } //  end if