InetAddress delegates all lookup operations to the system-wide
resolver.
The system-wide resolver can be customized by
deploying an implementation of InetAddressResolverProvider.
| Modifier and Type | Class and Description |
|---|---|
| public static class | InetAddressResolver.
A |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: String representing the host name mappingbyte array representing a raw IP address addr)Lookup the host name corresponding to the raw IP address provided. |
| public Stream | Returns: a stream of IP addresses for the requested hostthe specified hostname host, InetAddressResolver.the address lookup policy lookupPolicyGiven the name of a host, returns a stream of IP addresses of the requested address family associated with a provided hostname. |
| lookupByAddress | back to summary |
|---|---|
| public String lookupByAddress(byte[] addr) throws UnknownHostException Lookup the host name corresponding to the raw IP address provided. IPv4 address byte array must be 4 bytes long and IPv6 byte array must be 16 bytes long.
| |
| lookupByName | back to summary |
|---|---|
| public Stream Given the name of a host, returns a stream of IP addresses of the requested address family associated with a provided hostname. The address family type and addresses order are specified by the
| |
LookupPolicy object describes characteristics that can be applied to a lookup operation.
In particular, it is used to specify the ordering and which filtering should be performed when
looking up host addresses.
The default platform-wide lookup policy is constructed by consulting System Properties which affect how IPv4 and IPv6 addresses are returned.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| public static final int | IPV4
Characteristic value signifying if IPv4 addresses need to be queried during lookup. |
| public static final int | IPV4_FIRST
Characteristic value signifying if IPv4 addresses should be returned
first by |
| public static final int | IPV6
Characteristic value signifying if IPv6 addresses need to be queried during lookup. |
| public static final int | IPV6_FIRST
Characteristic value signifying if IPv6 addresses should be returned
first by |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: a characteristics valueReturns the set of characteristics of this lookup policy. |
| public static InetAddressResolver. | Returns: an instance ofInetAddressResolver.LookupPolicya value which represents the set of lookup characteristics characteristics)This factory method creates a |
| characteristics | back to summary |
|---|---|
| private final int characteristics | |
| IPV4 | back to summary |
|---|---|
| public static final int IPV4 Characteristic value signifying if IPv4 addresses need to be queried during lookup. | |
| IPV4_FIRST | back to summary |
|---|---|
| public static final int IPV4_FIRST Characteristic value signifying if IPv4 addresses should be returned
first by | |
| IPV6 | back to summary |
|---|---|
| public static final int IPV6 Characteristic value signifying if IPv6 addresses need to be queried during lookup. | |
| IPV6_FIRST | back to summary |
|---|---|
| public static final int IPV6_FIRST Characteristic value signifying if IPv6 addresses should be returned
first by | |
| LookupPolicy | back to summary |
|---|---|
| private LookupPolicy(int characteristics) | |
| characteristics | back to summary |
|---|---|
| public int characteristics() Returns the set of characteristics of this lookup policy.
| |
| of | back to summary |
|---|---|
| public static InetAddressResolver. This factory method creates a The
To request addresses of specific family types the following bit masks can be combined:
It is an error if neither LookupPolicy#IPV4 or LookupPolicy#IPV6 are set.
To request a specific ordering of the results:
If neither LookupPolicy#IPV4_FIRST or LookupPolicy#IPV6_FIRST are set it
implies "system"
order of addresses.
It is an error to request both LookupPolicy#IPV4_FIRST and LookupPolicy#IPV6_FIRST.
| |