ewe.net
Class URLStreamHandler

java.lang.Object
  extended byewe.net.URLStreamHandler

public class URLStreamHandler
extends Object


Constructor Summary
URLStreamHandler()
           
 
Method Summary
protected  boolean equals(URL url1, URL url2)
          Provides the default equals calculation.
protected  int getDefaultPort()
          Returns the default port for a URL parsed by this handler.
protected  int hashCode(URL url)
          Provides the default hash calculation.
protected  void parseURL(URL url, String spec, int start, int end)
          This method parses the string passed in as a URL and set's the instance data fields in the URL object passed in to the various values parsed out of the string.
protected  void setURL(URL u, String protocol, String host, int port, String file, String ref)
          Deprecated. 1.2 Please use #setURL(URL,String,String,int,String,String,String,String);
protected  String toExternalForm(URL u)
          This method converts a URL object into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Constructor Detail

URLStreamHandler

public URLStreamHandler()
Method Detail

equals

protected boolean equals(URL url1,
                         URL url2)
Provides the default equals calculation. May be overidden by handlers for other protocols that have different requirements for equals(). This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called by java.net.URL class.

Parameters:
url1 - An URL object
url2 - An URL object

getDefaultPort

protected int getDefaultPort()
Returns the default port for a URL parsed by this handler. This method is meant to be overidden by handlers with default port numbers.


hashCode

protected int hashCode(URL url)
Provides the default hash calculation. May be overidden by handlers for other protocols that have different requirements for hashCode calculation.


toExternalForm

protected String toExternalForm(URL u)
This method converts a URL object into a String. This method creates Strings in the mold of http URL's, so protocol handlers which use URL's that have a different syntax should override this method


parseURL

protected void parseURL(URL url,
                        String spec,
                        int start,
                        int end)
This method parses the string passed in as a URL and set's the instance data fields in the URL object passed in to the various values parsed out of the string. The start parameter is the position to start scanning the string. This is usually the position after the ":" which terminates the protocol name. The end parameter is the position to stop scanning. This will be either the end of the String, or the position of the "#" character, which separates the "file" portion of the URL from the "anchor" portion.

This method assumes URL's are formatted like http protocol URL's, so subclasses that implement protocols with URL's the follow a different syntax should override this method. The lone exception is that if the protocol name set in the URL is "file", this method will accept an empty hostname (i.e., "file:///"), which is legal for that protocol

Parameters:
url - The URL object in which to store the results
spec - The String-ized URL to parse
start - The position in the string to start scanning from
end - The position in the string to stop scanning

setURL

protected void setURL(URL u,
                      String protocol,
                      String host,
                      int port,
                      String file,
                      String ref)
Deprecated. 1.2 Please use #setURL(URL,String,String,int,String,String,String,String);

This methods sets the instance variables representing the various fields of the URL to the values passed in.

Parameters:
u - The URL to modify
protocol - The protocol to set
host - The host name to et
port - The port number to set
file - The filename to set
ref - The reference
Throws:
SecurityException - If the protocol handler of the URL is different from this one