org.lastbamboo.common.sdp
Class HostPort

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

public final class HostPort
extends GenericObject

Holds the hostname:port.

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan
This code is in the public domain.
See Also:
Serialized Form

Field Summary
protected  Host host
          host field
protected  int port
          port field
 
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
HostPort()
          Default constructor
 
Method Summary
 Object clone()
          Clones this object.
 String encode()
          Encode this hostport into its string representation.
 boolean equals(Object other)
          returns true if the two objects are equals, false otherwise.
 Host getHost()
          get the Host field
 InetAddress getInetAddress()
          Return the internet address corresponding to the host.
 int getPort()
          get the port field
 boolean hasPort()
          Returns boolean value indicating if Header has port
 void merge(Object mergeObject)
          Recursively override the fields of this object with the fields of a new object.
 void removePort()
          remove port.
 void setHost(Host h)
          Set the host member
 void setPort(int p)
          Set the port member
 String toString()
           
 
Methods inherited from class org.lastbamboo.common.sdp.GenericObject
Assert, dbgPrint, dbgPrint, debugDump, debugDump, getIndentation, getMatcher, isMySubclass, makeClone, match, 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, wait, wait, wait
 

Field Detail

host

protected Host host
host field


port

protected int port
port field

Constructor Detail

HostPort

public HostPort()
Default constructor

Method Detail

encode

public String encode()
Encode this hostport into its string representation. Note that this could be different from the string that has been parsed if something has been edited.

Specified by:
encode in class GenericObject
Returns:
String

equals

public boolean equals(Object other)
returns true if the two objects are equals, false otherwise.

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

getHost

public Host getHost()
get the Host field

Returns:
host field

getPort

public int getPort()
get the port field

Returns:
int

hasPort

public boolean hasPort()
Returns boolean value indicating if Header has port

Returns:
boolean value indicating if Header has port

removePort

public void removePort()
remove port.


setHost

public void setHost(Host h)
Set the host member

Parameters:
h - Host to set

setPort

public void setPort(int p)
Set the port member

Parameters:
p - int to set

getInetAddress

public InetAddress getInetAddress()
                           throws UnknownHostException
Return the internet address corresponding to the host.

Returns:
the inet address for the host.
Throws:
java.net.UnkownHostException - if host name cannot be resolved.
UnknownHostException

merge

public void merge(Object mergeObject)
Description copied from class: GenericObject
Recursively override the fields of this object with the fields of a new object. This is useful when you want to genrate a template and override the fields of an incoming SIPMessage with another SIP message that you have already generated.

Overrides:
merge in class GenericObject
Parameters:
mergeObject - is the replacement object. The override obect must be of the same class as this object. Set any fields that you do not want to override as null in the mergeOject object.

clone

public Object clone()
Description copied from class: GenericObject
Clones this object.

Overrides:
clone in class GenericObject

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 LittleShoot. All Rights Reserved.