org.lastbamboo.common.sip.stack.util
Class UriUtilsImpl

java.lang.Object
  extended by org.lastbamboo.common.sip.stack.util.UriUtilsImpl
All Implemented Interfaces:
UriUtils

public class UriUtilsImpl
extends Object
implements UriUtils

An implementation of the URI utilities interface.


Constructor Summary
UriUtilsImpl()
           
 
Method Summary
 String getHostInSipUri(URI sipUri)
          Returns the host portion of a SIP URI (in the form of an opaque java.net.URI).
 int getPersonIdInSipUri(URI sipUri)
          Returns the user portion of a SIP URI (in the form of an opaque java.net.URI) as a Little Shoot person identifier.
 int getPortInSipUri(URI uri)
          Extracts the port from a SIP URI.
 URI getSipUri(String host)
          Returns a SIP URI for a given host of the form "sip:host".
 URI getSipUri(String host, int port)
          Returns a SIP URI for a given host and port of the form "sip:host:port".
 URI getSipUri(String host, int port, String transport)
          Returns a SIP URI for a given host and port of the form "sip:host:port".
 URI getUri(String uriString)
          Returns a URI from a string.
 URI getUriForHost(String host)
          Returns a URI from a host.
 URI getUriWithPort(URI uri, int port)
          Returns a URI with a modified port.
 String getUserInSipUri(URI sipUri)
          Returns the user portion of a SIP URI (in the form of an opaque java.net.URI).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriUtilsImpl

public UriUtilsImpl()
Method Detail

getUri

public URI getUri(String uriString)
Description copied from interface: UriUtils
Returns a URI from a string.

Specified by:
getUri in interface UriUtils
Parameters:
uriString - The string containing a URI-formatting string.
Returns:
The URI represented by the passed string.

getUriForHost

public URI getUriForHost(String host)
Description copied from interface: UriUtils
Returns a URI from a host.

Specified by:
getUriForHost in interface UriUtils
Parameters:
host - The host.
Returns:
The URI representing the given host.

getSipUri

public URI getSipUri(String host)
Description copied from interface: UriUtils
Returns a SIP URI for a given host of the form "sip:host".

Specified by:
getSipUri in interface UriUtils
Parameters:
host - The host.
Returns:
A URI for the given scheme, host, and port.

getSipUri

public URI getSipUri(String host,
                     int port)
Description copied from interface: UriUtils
Returns a SIP URI for a given host and port of the form "sip:host:port".

Specified by:
getSipUri in interface UriUtils
Parameters:
host - The host.
port - The port.
Returns:
A URI for the given scheme, host, and port.

getSipUri

public URI getSipUri(String host,
                     int port,
                     String transport)
Description copied from interface: UriUtils
Returns a SIP URI for a given host and port of the form "sip:host:port".

Specified by:
getSipUri in interface UriUtils
Parameters:
host - The host.
port - The port.
transport - The transport to be used to connect.
Returns:
A URI for the given scheme, host, and port.

getUriWithPort

public URI getUriWithPort(URI uri,
                          int port)
Description copied from interface: UriUtils
Returns a URI with a modified port.

Specified by:
getUriWithPort in interface UriUtils
Parameters:
uri - The original URI.
port - The new port.
Returns:
The URI with the new port.

getUserInSipUri

public String getUserInSipUri(URI sipUri)
Description copied from interface: UriUtils
Returns the user portion of a SIP URI (in the form of an opaque java.net.URI).

Specified by:
getUserInSipUri in interface UriUtils
Parameters:
sipUri - The URI.
Returns:
The user portion of the SIP URI.

getHostInSipUri

public String getHostInSipUri(URI sipUri)
Description copied from interface: UriUtils
Returns the host portion of a SIP URI (in the form of an opaque java.net.URI).

Specified by:
getHostInSipUri in interface UriUtils
Parameters:
sipUri - The URI.
Returns:
The host portion of the SIP URI.

getPersonIdInSipUri

public int getPersonIdInSipUri(URI sipUri)
Description copied from interface: UriUtils
Returns the user portion of a SIP URI (in the form of an opaque java.net.URI) as a Little Shoot person identifier.

Specified by:
getPersonIdInSipUri in interface UriUtils
Parameters:
sipUri - The URI.
Returns:
The user portion of the SIP URI as a Little Shoot person identifier..

getPortInSipUri

public int getPortInSipUri(URI uri)
Description copied from interface: UriUtils
Extracts the port from a SIP URI. If the URI does not specify a port, this returns the default port, such as 5060 for sip: URIs and 5061 for sips: URIs.

Specified by:
getPortInSipUri in interface UriUtils
Parameters:
uri - The URI to extract the port from.
Returns:
The port in the SIP URI, or the default port if it is not specified.


Copyright © 2013 LittleShoot. All Rights Reserved.