ch.ethz.iks.r_osgi
Class URI

java.lang.Object
  extended by ch.ethz.iks.r_osgi.URI
All Implemented Interfaces:
java.io.Serializable

public final class URI
extends java.lang.Object
implements java.io.Serializable

URI is, well, an URI, as described in RFC 2396. Since java.net.URI exists only since version 1.4, R-OSGi uses its own URI class. This is a lightweight implementation, it does only as much as is needed for R-OSGi. Furthermore, certain protocol schemes do address resolution to avoid URI schizophrenia.

Author:
Jan S. Rellermeyer, ETH Zurich
See Also:
Serialized Form

Constructor Summary
URI(java.lang.String uriString)
          create a new URI.
URI(java.lang.String uriString, boolean hostLookup)
          create a new URI
 
Method Summary
static URI create(java.lang.String uriString)
          convenience method for creating a new URI instance.
 boolean equals(java.lang.Object other)
           
 java.lang.String getFragment()
          get the fragment.
 java.lang.String getHost()
          get the host name.
 int getPort()
          get the port.
 java.lang.String getScheme()
          get the protocol scheme.
 int hashCode()
           
 URI resolve(java.lang.String add)
          resolve a relative fragment against this absolute base URI.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URI

public URI(java.lang.String uriString)
create a new URI.

Parameters:
uriString - the string.

URI

public URI(java.lang.String uriString,
           boolean hostLookup)
create a new URI

Parameters:
uriString - the string
hostLookup - do a host lookup?
Method Detail

create

public static URI create(java.lang.String uriString)
convenience method for creating a new URI instance. Never throws and exception, even if the input is not well-formed. Should be used only in controlled environments when it can be assured that the input is valid.

Parameters:
uriString - the uri string.
Returns:
an URI.

getScheme

public java.lang.String getScheme()
get the protocol scheme.

Returns:
the scheme.

getHost

public java.lang.String getHost()
get the host name.

Returns:
the host name.

getPort

public int getPort()
get the port.

Returns:
the port.

getFragment

public java.lang.String getFragment()
get the fragment.

Returns:
the fragment (without the #).

resolve

public URI resolve(java.lang.String add)
resolve a relative fragment against this absolute base URI.

Parameters:
add - the fragment.
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)


Copyright © 2009 IKS, ETH Zurich. All Rights Reserved.