InetAddressdelegates all lookup operations to the system-wide resolver.
Nested Class SummaryModifier and TypeInterfaceDescription
static final classA
LookupPolicyobject describes characteristics that can be applied to a lookup operation.
Method SummaryModifier and TypeMethodDescription
(byte addr)Lookup the host name corresponding to the raw IP address provided.Given the name of a host, returns a stream of IP addresses of the requested address family associated with a provided hostname.
(String host, InetAddressResolver.LookupPolicy lookupPolicy) throws UnknownHostExceptionGiven the name of a host, returns a stream of IP addresses of the requested address family associated with a provided hostname.
hostshould be a machine name, such as "
www.example.com", not a textual representation of its IP address. No validation is performed on the given
hostname: if a textual representation is supplied, the name resolution is likely to fail and
UnknownHostExceptionmay be thrown.
The address family type and addresses order are specified by the
LookupPolicyinstance. Lookup operation characteristics could be acquired with
InetAddressResolver.LookupPolicy.IPV6characteristics provided then this method returns addresses of both IPV4 and IPV6 families.
host- the specified hostname
lookupPolicy- the address lookup policy
- a stream of IP addresses for the requested host
NullPointerException- if either parameter is
UnknownHostException- if no IP address for the
hostcould be found
- See Also:
lookupByAddressLookup the host name corresponding to the raw IP address provided.
addrargument is in network byte order: the highest order byte of the address is in
IPv4 address byte array must be 4 bytes long and IPv6 byte array must be 16 bytes long.
addr- byte array representing a raw IP address
Stringrepresenting the host name mapping
UnknownHostException- if no host name is found for the specified IP address
IllegalArgumentException- if the length of the provided byte array doesn't correspond to a valid IP address length
NullPointerException- if addr is