ch.ethz.iks.r_osgi
Class URI

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

public final class URI
extends Object
implements 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 support host name resolution to avoid URI schizophrenia.

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

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

Constructor Detail

URI

public URI(String uriString)
create a new URI.

Parameters:
uriString - the string.
Method Detail

create

public static URI create(String uriString)
convenience method for creating a new URI instance. Never throws and exception, even if the input is unparsable. 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 String getScheme()
get the protocol scheme.

Returns:
the scheme.

getHostName

public String getHostName()
get the host name.

Returns:
the host name.

getPort

public int getPort()
get the port.

Returns:
the port.

getFragment

public String getFragment()
get the fragment.

Returns:
the fragment (without the #).

resolve

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

Parameters:
add - the fragment.
Returns:

hashCode

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

toString

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

equals

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