@InterfaceAudience.Private public class Addressing extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
Addressing.AddressSelectionCondition
Interface for AddressSelectionCondition to check if address is acceptable
|
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
HOSTNAME_PORT_SEPARATOR |
static String |
VALID_PORT_REGEX |
| 构造器和说明 |
|---|
Addressing() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
createHostAndPortStr(String hostname,
int port) |
static InetSocketAddress |
createInetSocketAddressFromHostAndPortStr(String hostAndPort) |
static InetAddress |
getIp4Address() |
static InetAddress |
getIp6Address() |
static InetAddress |
getIpAddress() |
static boolean |
isLocalAddress(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 String |
parseHostname(String hostAndPort) |
static int |
parsePort(String hostAndPort) |
public static InetSocketAddress createInetSocketAddressFromHostAndPortStr(String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>public static String createHostAndPortStr(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 String parseHostname(String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>hostAndPortpublic static int parsePort(String hostAndPort)
hostAndPort - Formatted as <hostname> ':' <port>hostAndPortpublic static InetAddress getIpAddress() throws SocketException
SocketExceptionpublic static InetAddress getIp4Address() throws SocketException
SocketExceptionpublic static InetAddress getIp6Address() throws SocketException
SocketExceptionpublic static boolean isLocalAddress(InetAddress addr)
addr - address to check if it is local node's addressCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.