Package io.servicetalk.transport.api
Interface HostAndPort
-
public interface HostAndPort
A tuple of<host name, port>
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
hostName()
Returns the host name.static HostAndPort
of(java.lang.String host, int port)
Returns aHostAndPort
object for the specified values.static HostAndPort
of(java.net.InetSocketAddress address)
Create a newHostAndPort
from aInetSocketAddress
.int
port()
Returns the port.
-
-
-
Method Detail
-
hostName
java.lang.String hostName()
Returns the host name.- Returns:
- The hostname
-
port
int port()
Returns the port.- Returns:
- The port
-
of
static HostAndPort of(java.lang.String host, int port)
Returns aHostAndPort
object for the specified values.- Parameters:
host
- host nameport
- port- Returns:
- the
HostAndPort
-
of
static HostAndPort of(java.net.InetSocketAddress address)
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
.
-
-