Interface HostAndPort


  • public interface HostAndPort
    A tuple of <host name, 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 a HostAndPort object for the specified values.
        Parameters:
        host - host name
        port - port
        Returns:
        the HostAndPort
      • of

        static HostAndPort of​(java.net.InetSocketAddress address)
        Create a new HostAndPort from a InetSocketAddress.

        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 - The InetSocketAddress to convert.
        Returns:
        the HostAndPort.