Package io.servicetalk.transport.api
Interface HostAndPort
public interface HostAndPort
A tuple of
<host name, port>
.-
Method Summary
Modifier and TypeMethodDescriptionhostName()
Returns the host name.static HostAndPort
Returns aHostAndPort
object for the specified values.static HostAndPort
of
(InetSocketAddress address) Create a newHostAndPort
from aInetSocketAddress
.static HostAndPort
Parse IPv4xxx.xxx.xxx.xxx:yyyyy
and IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
style addresses.static HostAndPort
Parse IPv4xxx.xxx.xxx.xxx:yyyyy
and IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
style addresses.int
port()
Returns the port.
-
Method Details
-
hostName
String hostName()Returns the host name.- Returns:
- The hostname
-
port
int port()Returns the port.- Returns:
- The port
-
of
Returns aHostAndPort
object for the specified values.- Parameters:
host
- host nameport
- port- Returns:
- the
HostAndPort
-
of
Create a newHostAndPort
from aInetSocketAddress
.Note that creation of a
InetSocketAddress
may use the JDK's blocking DNS resolution. Take care to only create these objects if you intend to use the JDK's blocking DNS resolution, and you are safe to block.- Parameters:
address
- TheInetSocketAddress
to convert.- Returns:
- the
HostAndPort
.
-
ofIpPort
Parse IPv4xxx.xxx.xxx.xxx:yyyyy
and IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
style addresses.- Parameters:
ipPort
- An IPv4xxx.xxx.xxx.xxx:yyyyy
or IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
addresses.- Returns:
- A
HostAndPort
where the hostname is the IP address and the port is parsed from the string. - See Also:
-
ofIpPort
Parse IPv4xxx.xxx.xxx.xxx:yyyyy
and IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
style addresses.- Parameters:
ipPort
- An IPv4xxx.xxx.xxx.xxx:yyyyy
or IPv6[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:yyyyy
addresses.startIndex
- The index at which the address parsing starts.- Returns:
- A
HostAndPort
where the hostname is the IP address and the port is parsed from the string.
-