org.knopflerfish.framework
Class BundleURLStreamHandler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.knopflerfish.framework.BundleURLStreamHandler

public class BundleURLStreamHandler
extends java.net.URLStreamHandler

Bundle URL handling.


Field Summary
static java.lang.String PERM_OK
           
static java.lang.String PROTOCOL
           
 
Method Summary
protected  boolean equals(java.net.URL u1, java.net.URL u2)
          Equals calculation for bundle URLs.
protected  java.net.InetAddress getHostAddress(java.net.URL url)
           
protected  int hashCode(java.net.URL u)
          Provides the hash calculation
protected  boolean hostsEqual(java.net.URL u1, java.net.URL u2)
          Compares the host components of two URLs.
 java.net.URLConnection openConnection(java.net.URL u)
           
protected  void parseURL(java.net.URL u, java.lang.String s, int start, int limit)
           
protected  boolean sameFile(java.net.URL u1, java.net.URL u2)
          Compare two urls to see whether they refer to the same file, i.e., having the same protocol, host, port, and path.
protected  java.lang.String toExternalForm(java.net.URL url)
          Converts a bundle URL to a String.
 
Methods inherited from class java.net.URLStreamHandler
getDefaultPort, openConnection, setURL, setURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL

public static final java.lang.String PROTOCOL
See Also:
Constant Field Values

PERM_OK

public static final java.lang.String PERM_OK
See Also:
Constant Field Values
Method Detail

openConnection

public java.net.URLConnection openConnection(java.net.URL u)
Specified by:
openConnection in class java.net.URLStreamHandler

parseURL

protected void parseURL(java.net.URL u,
                        java.lang.String s,
                        int start,
                        int limit)
Overrides:
parseURL in class java.net.URLStreamHandler

equals

protected boolean equals(java.net.URL u1,
                         java.net.URL u2)
Equals calculation for bundle URLs.

Overrides:
equals in class java.net.URLStreamHandler
Returns:
true if the two urls are considered equal, ie. they refer to the same fragment in the same file.

hashCode

protected int hashCode(java.net.URL u)
Provides the hash calculation

Overrides:
hashCode in class java.net.URLStreamHandler
Returns:
an int suitable for hash table indexing

sameFile

protected boolean sameFile(java.net.URL u1,
                           java.net.URL u2)
Compare two urls to see whether they refer to the same file, i.e., having the same protocol, host, port, and path.

Overrides:
sameFile in class java.net.URLStreamHandler
Returns:
true if u1 and u2 refer to the same file

hostsEqual

protected boolean hostsEqual(java.net.URL u1,
                             java.net.URL u2)
Compares the host components of two URLs.

Overrides:
hostsEqual in class java.net.URLStreamHandler
Parameters:
u1 - the URL of the first host to compare
u2 - the URL of the second host to compare
Returns:
true if and only if they are equal, false otherwise.

toExternalForm

protected java.lang.String toExternalForm(java.net.URL url)
Converts a bundle URL to a String.

Overrides:
toExternalForm in class java.net.URLStreamHandler
Parameters:
url - the URL.
Returns:
a string representation of the URL.

getHostAddress

protected java.net.InetAddress getHostAddress(java.net.URL url)
Overrides:
getHostAddress in class java.net.URLStreamHandler