org.lastbamboo.common.sdp
Class Host

java.lang.Object
  extended by org.lastbamboo.common.sdp.GenericObject
      extended by org.lastbamboo.common.sdp.Host
All Implemented Interfaces:
Serializable, Cloneable

public class Host
extends GenericObject

Stores hostname.

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan , Emil Ivov IPV6 Support.
This code is in the public domain. IPv6 Support added by Emil Ivov (emil_ivov@yahoo.com)
Network Research Team (http://www-r2.u-strasbg.fr))
Louis Pasteur University - Strasbourg - France
Marc Bednarek (Bugfixes).
See Also:
Serialized Form

Field Summary
protected  int addressType
          address field
protected  String hostname
          hostName field
protected static int HOSTNAME
           
protected static int IPV4ADDRESS
           
protected static int IPV6ADDRESS
           
 
Fields inherited from class org.lastbamboo.common.sdp.GenericObject
AND, AT, COLON, COMMA, DOT, DOUBLE_QUOTE, EQUALS, GREATER_THAN, HT, immutableClasses, immutableClassNames, indentation, LESS_THAN, LPAREN, matchExpression, NEWLINE, PERCENT, POUND, QUESTION, QUOTE, RETURN, RPAREN, SEMICOLON, SLASH, SP, STAR, stringRepresentation
 
Constructor Summary
Host()
          default constructor
Host(String hostName)
          Constructor given host name or IP address.
Host(String name, int addrType)
          constructor
 
Method Summary
 String encode()
          Return the host name in encoded form.
 boolean equals(Object obj)
          Compare for equality of hosts.
 String getAddress()
          get the Address field
 String getHostname()
          get the HostName field
 InetAddress getInetAddress()
          Get the inet address from this host.
 String getIpAddress()
          Convenience function to get the raw IP destination address of a SIP message as a String.
 boolean isHostname()
          Return true if the address is a DNS host name (and not an IPV4 address)
 boolean isIPAddress()
          Return true if the address is a DNS host name (and not an IPV4 address)
 void setAddress(String address)
          Set the address member
 void setHostAddress(String address)
          Set the IP Address.
 void setHostname(String h)
          Set the hostname member.
 
Methods inherited from class org.lastbamboo.common.sdp.GenericObject
Assert, clone, dbgPrint, dbgPrint, debugDump, debugDump, getIndentation, getMatcher, isMySubclass, makeClone, match, merge, replace, replace, replace, replace, setMatcher, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOSTNAME

protected static final int HOSTNAME
See Also:
Constant Field Values

IPV4ADDRESS

protected static final int IPV4ADDRESS
See Also:
Constant Field Values

IPV6ADDRESS

protected static final int IPV6ADDRESS
See Also:
Constant Field Values

hostname

protected String hostname
hostName field


addressType

protected int addressType
address field

Constructor Detail

Host

public Host()
default constructor


Host

public Host(String hostName)
     throws IllegalArgumentException
Constructor given host name or IP address.

Throws:
IllegalArgumentException

Host

public Host(String name,
            int addrType)
constructor

Parameters:
name - String to set
addrType - int to set
Method Detail

encode

public String encode()
Return the host name in encoded form.

Specified by:
encode in class GenericObject
Returns:
String

equals

public boolean equals(Object obj)
Compare for equality of hosts. Host names are compared by textual equality. No dns lookup is performed.

Overrides:
equals in class GenericObject
Parameters:
obj - Object to set
Returns:
boolean

getHostname

public String getHostname()
get the HostName field

Returns:
String

getAddress

public String getAddress()
get the Address field

Returns:
String

getIpAddress

public String getIpAddress()
Convenience function to get the raw IP destination address of a SIP message as a String.

Returns:
String

setHostname

public void setHostname(String h)
Set the hostname member.

Parameters:
h - String to set

setHostAddress

public void setHostAddress(String address)
Set the IP Address.

Parameters:
address - is the address string to set.

setAddress

public void setAddress(String address)
Set the address member

Parameters:
address - address String to set

isHostname

public boolean isHostname()
Return true if the address is a DNS host name (and not an IPV4 address)

Returns:
true if the hostname is a DNS name

isIPAddress

public boolean isIPAddress()
Return true if the address is a DNS host name (and not an IPV4 address)

Returns:
true if the hostname is host address.

getInetAddress

public InetAddress getInetAddress()
                           throws UnknownHostException
Get the inet address from this host. Caches the inet address returned from dns lookup to avoid lookup delays.

Throws:
UnkownHostexception - when the host name cannot be resolved.
UnknownHostException


Copyright © 2013 LittleShoot. All Rights Reserved.