@InterfaceAudience.Private public class Addressing extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Addressing.AddressSelectionCondition
Interface for AddressSelectionCondition to check if address is acceptable
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HOSTNAME_PORT_SEPARATOR |
static java.lang.String |
VALID_PORT_REGEX |
| Constructor and Description |
|---|
Addressing() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
createHostAndPortStr(java.lang.String hostname,
int port) |
static java.net.InetSocketAddress |
createInetSocketAddressFromHostAndPortStr(java.lang.String hostAndPort) |
static java.net.InetAddress |
getIp4Address() |
static java.net.InetAddress |
getIp6Address() |
static java.net.InetAddress |
getIpAddress() |
static boolean |
isLocalAddress(java.net.InetAddress addr)
Given an InetAddress, checks to see if the address is a local address, by comparing the address
with all the interfaces on the node.
|
static java.lang.String |
parseHostname(java.lang.String hostAndPort) |
static int |
parsePort(java.lang.String hostAndPort) |
public static final java.lang.String VALID_PORT_REGEX
public static final java.lang.String HOSTNAME_PORT_SEPARATOR
public static java.net.InetSocketAddress createInetSocketAddressFromHostAndPortStr(java.lang.String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>public static java.lang.String createHostAndPortStr(java.lang.String hostname,
int port)
hostname - Server hostnameport - Server porthostname and
port in following
form: <hostname> ':' <port>. For example, if hostname
is example.org and port is 1234, this method will return
example.org:1234public static java.lang.String parseHostname(java.lang.String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>hostAndPortpublic static int parsePort(java.lang.String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>hostAndPortpublic static java.net.InetAddress getIpAddress()
throws java.net.SocketException
java.net.SocketExceptionpublic static java.net.InetAddress getIp4Address()
throws java.net.SocketException
java.net.SocketExceptionpublic static java.net.InetAddress getIp6Address()
throws java.net.SocketException
java.net.SocketExceptionpublic static boolean isLocalAddress(java.net.InetAddress addr)
addr - address to check if it is local node's address