Class Address


  • public final class Address
    extends Object
    Representation of a network address.
    • Constructor Detail

      • Address

        public Address​(String host,
                       int port)
    • Method Detail

      • local

        public static Address local()
        Returns an address that binds to all interfaces.
        Returns:
        the address
      • from

        public static Address from​(String address)
        Returns the address from the given host:port string.
        Parameters:
        address - the address string
        Returns:
        the address
      • from

        public static Address from​(String host,
                                   int port)
        Returns an address for the given host/port.
        Parameters:
        host - the host name
        port - the port
        Returns:
        a new address
      • from

        public static Address from​(int port)
        Returns an address for the local host and the given port.
        Parameters:
        port - the port
        Returns:
        a new address
      • host

        public String host()
        Returns the host name.
        Returns:
        the host name
      • port

        public int port()
        Returns the port.
        Returns:
        the port
      • address

        public InetAddress address()
        Returns the IP address.
        Returns:
        the IP address
      • address

        public InetAddress address​(boolean resolve)
        Returns the IP address.
        Parameters:
        resolve - whether to force resolve the hostname
        Returns:
        the IP address
      • type

        public Address.Type type()
        Returns the address type.
        Returns:
        the address type
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object