public final class SocketUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
format(SocketAddress s,
int defaultPort)
Format an address string into
host:port or *:port syntax. |
static String |
format(String hostname,
int port)
Format an address string into
host:port or *:port syntax. |
static String |
hostname(InetSocketAddress addr)
Get the name or IP address, or
* if this address is a wildcard IP. |
static boolean |
isIPv6(InetAddress ip)
True if this InetAddress is a raw IPv6 in dotted quad notation.
|
static InetSocketAddress |
parse(String desc,
int defaultPort)
Parse an address string such as
host:port or *:port . |
static InetSocketAddress |
resolve(String desc,
int defaultPort)
Parse and resolve an address string, looking up the IP address.
|
public static boolean isIPv6(InetAddress ip)
public static String hostname(InetSocketAddress addr)
*
if this address is a wildcard IP.public static String format(SocketAddress s, int defaultPort)
host:port
or *:port
syntax.public static String format(String hostname, int port)
host:port
or *:port
syntax.public static InetSocketAddress parse(String desc, int defaultPort)
host:port
or *:port
.public static InetSocketAddress resolve(String desc, int defaultPort)