public final class InetSocketAddressHelper extends Object
InetSocketAddress. The literal '*' can be specified for port as an alternative
to '0' to indicate any local port.| Modifier and Type | Field and Description |
|---|---|
static com.google.common.base.Function<InetSocketAddress,String> |
INET_TO_STR |
static com.google.common.base.Function<Integer,InetSocketAddress> |
INT_TO_INET
A function that uses
getLocalAddress(int) to map a local port number to an
InetSocketAddress. |
static com.google.common.base.Function<String,InetSocketAddress> |
STR_TO_INET
A function that uses
parse(String) to map an endpoint spec to an
InetSocketAddress. |
| Modifier and Type | Method and Description |
|---|---|
static Set<InetSocketAddress> |
convertToSockets(Iterable<String> backends)
Converts backend definitions (in host:port form) a set of socket addresses.
|
static InetSocketAddress |
getLocalAddress(int port) |
static InetSocketAddress |
parse(String value)
Attempts to parse an endpoint spec into an InetSocketAddress.
|
static String |
toString(InetSocketAddress value)
Attempts to return a usable String given an InetSocketAddress.
|
public static final com.google.common.base.Function<String,InetSocketAddress> STR_TO_INET
parse(String) to map an endpoint spec to an
InetSocketAddress.public static final com.google.common.base.Function<Integer,InetSocketAddress> INT_TO_INET
getLocalAddress(int) to map a local port number to an
InetSocketAddress.
If an UnknownHostException is thrown, it will be propagated as a
RuntimeException.public static final com.google.common.base.Function<InetSocketAddress,String> INET_TO_STR
public static InetSocketAddress parse(String value)
value - the endpoint specNullPointerException - if value is nullIllegalArgumentException - if value cannot be parsedpublic static String toString(InetSocketAddress value)
value - the InetSocketAddress.public static InetSocketAddress getLocalAddress(int port) throws UnknownHostException
UnknownHostExceptionpublic static Set<InetSocketAddress> convertToSockets(Iterable<String> backends)
backends - Backends to convert.