home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / netscape / net / URLStreamHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  1.4 KB  |  22 lines

  1. package netscape.net;
  2.  
  3. import java.net.URL;
  4. import java.net.URLConnection;
  5.  
  6. public class URLStreamHandler extends java.net.URLStreamHandler {
  7.    protected URLConnection openConnection(URL u) {
  8.       return new netscape.net.URLConnection(u);
  9.    }
  10.  
  11.    protected void parseURL(URL u, String spec, int start, int limit) {
  12.       super.parseURL(u, spec, start, limit);
  13.       String protocol = u.getProtocol();
  14.       if (protocol.equals("about") || protocol.equals("mailto") || protocol.equals("news") || protocol.equals("snews") || protocol.equals("javascript") || protocol.equals("livescript") || protocol.equals("mocha")) {
  15.          String file = u.getFile();
  16.          file = file.substring(1, file.length());
  17.          ((java.net.URLStreamHandler)this).setURL(u, protocol, u.getHost(), u.getPort(), file, u.getRef());
  18.       }
  19.  
  20.    }
  21. }
  22.