FileDocCategorySizeDatePackage
DMoz.javaAPI DocExample791Sat Sep 09 19:54:14 BST 2000None

DMoz

public class DMoz extends Object

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

  
    String target = "";
    
    for (int i = 0; i < args.length; i++) {
      target += args[i] + " ";
    }
    target = target.trim();
    QueryString query = new QueryString("search", target);
    try {
      URL u = new URL("http://search.dmoz.org/cgi-bin/search?" + query);
      InputStream in = new BufferedInputStream(u.openStream());
      InputStreamReader theHTML = new InputStreamReader(in);
      int c;
      while ((c = theHTML.read()) != -1) {
        System.out.print((char) c);
      } 
    }
    catch (MalformedURLException e) {
      System.err.println(e);
    }
    catch (IOException e) {
      System.err.println(e);
    }