FileDocCategorySizeDatePackage
URLTyper.javaAPI DocExample621Fri Feb 03 16:07:54 GMT 2006None

URLTyper

public class URLTyper extends Object

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


    if (args.length != 1) {
      System.err.println("Usage: java URLTyper url");
      return;
    }
  
    InputStream in = null;
    try {
      URL u = new URL(args[0]);
      in = u.openStream();
      for (int c = in.read(); c != -1; c = in.read()) {
        System.out.write(c);
      }
      in.close();
    } 
    catch (MalformedURLException ex) {
      System.err.println(args[0] + " is not a URL Java understands.");
    }
    finally {
      if (in != null) in.close();
    }