Interface DnsResolver

  • All Known Implementing Classes:
    InMemoryDnsResolver, SystemDefaultDnsResolver

    @Contract(threading=STATELESS)
    public interface DnsResolver
    Users may implement this interface to override the normal DNS lookup offered by the OS.
    Since:
    4.2
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.net.InetAddress[] resolve​(java.lang.String host)
      Returns the IP address for the specified host name, or null if the given host is not recognized or the associated IP address cannot be used to build an InetAddress instance.
      default java.util.List<java.net.InetSocketAddress> resolve​(java.lang.String host, int port)
      Returns a list of InetSocketAddress for the given host with the given port.
      java.lang.String resolveCanonicalHostname​(java.lang.String host)
      Gets the fully qualified domain name for given host name.
    • Method Detail

      • resolve

        java.net.InetAddress[] resolve​(java.lang.String host)
                                throws java.net.UnknownHostException
        Returns the IP address for the specified host name, or null if the given host is not recognized or the associated IP address cannot be used to build an InetAddress instance.
        Parameters:
        host - The host name to be resolved by this resolver.
        Returns:
        The IP address associated to the given host name, or null if the host name is not known by the implementation class.
        Throws:
        java.net.UnknownHostException
        See Also:
        InetAddress
      • resolveCanonicalHostname

        java.lang.String resolveCanonicalHostname​(java.lang.String host)
                                           throws java.net.UnknownHostException
        Gets the fully qualified domain name for given host name.
        Throws:
        java.net.UnknownHostException
        Since:
        5.0
      • resolve

        default java.util.List<java.net.InetSocketAddress> resolve​(java.lang.String host,
                                                                   int port)
                                                            throws java.net.UnknownHostException
        Returns a list of InetSocketAddress for the given host with the given port.
        Throws:
        java.net.UnknownHostException
        Since:
        5.5
        See Also:
        InetSocketAddress