public class Host extends GenericObject
Modifier and Type | Field and Description |
---|---|
protected int |
addressType
address field
|
protected String |
hostname
hostName field
|
protected static int |
HOSTNAME |
protected static int |
IPV4ADDRESS |
protected static int |
IPV6ADDRESS |
AND, AT, COLON, COMMA, DOT, DOUBLE_QUOTE, EQUALS, GREATER_THAN, HT, immutableClasses, indentation, LESS_THAN, LPAREN, matchExpression, NEWLINE, PERCENT, POUND, QUESTION, QUOTE, RETURN, RPAREN, SEMICOLON, SLASH, SP, STAR, stringRepresentation
Constructor and Description |
---|
Host()
default constructor
|
Host(String hostName)
Constructor given host name or IP address.
|
Host(String name,
int addrType)
constructor
|
Modifier and Type | Method and Description |
---|---|
String |
encode()
Return the host name in encoded form.
|
StringBuilder |
encode(StringBuilder buffer)
Put the encoded version of this object in the given StringBuilder.
|
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.
|
int |
hashCode() |
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)
|
static boolean |
isIPv6Reference(String address)
Verifies whether the ipv6reference, i.e.
|
void |
setAddress(String address)
Set the address member
|
void |
setHostAddress(String address)
Set the IP Address.
|
void |
setHostname(String h)
Set the hostname member.
|
clone, dbgPrint, dbgPrint, debugDump, debugDump, getClassFromName, getIndentation, getMatcher, isMySubclass, makeClone, match, merge, setMatcher, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint
protected static final int HOSTNAME
protected static final int IPV4ADDRESS
protected static final int IPV6ADDRESS
protected String hostname
protected int addressType
public Host()
public Host(String hostName) throws IllegalArgumentException
IllegalArgumentException
public Host(String name, int addrType)
name
- String to setaddrType
- int to setpublic String encode()
encode
in class GenericObject
public StringBuilder encode(StringBuilder buffer)
GenericObject
encode
in class GenericObject
public boolean equals(Object obj)
equals
in class GenericObject
obj
- Object to setpublic String getHostname()
public String getAddress()
public String getIpAddress()
public void setHostname(String h)
h
- String to setpublic void setHostAddress(String address)
address
- is the address string to set.public void setAddress(String address)
address
- address String to setpublic boolean isHostname()
public boolean isIPAddress()
public InetAddress getInetAddress() throws UnknownHostException
UnkownHostexception
- when the host name cannot be resolved.UnknownHostException
public static boolean isIPv6Reference(String address)
Copyright © 2018. All Rights Reserved.