Package org.xbill.DNS.spi
Class DNSJavaNameService
java.lang.Object
org.xbill.DNS.spi.DNSJavaNameService
- All Implemented Interfaces:
NameService
This class implements a Name Service Provider, which Java can use (starting with version 1.4), to
perform DNS resolutions instead of using the standard calls.
This Name Service Provider uses dnsjava.
To use this provider, you must set the following system property:
sun.net.spi.nameservice.provider.1=dns,dnsjava
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final Stringprivate InetAddress[]private Nameprivate InetAddress[]private static final Stringprivate static final Stringprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a DNSJavaNameService instance. -
Method Summary
Modifier and TypeMethodDescriptiongetHostByAddr(byte[] addr) Performs a reverse DNS lookup.lookupAllHostAddr(String host) Performs a forward DNS lookup for the host name.
-
Field Details
-
NAMESERVERS_PROPERTY
- See Also:
-
DOMAIN_PROPERTY
- See Also:
-
PREFER_V6_PROPERTY
- See Also:
-
preferV6
private final boolean preferV6 -
localhostName
-
localhostNamedAddresses
-
localhostAddresses
-
addressesLoaded
private boolean addressesLoaded
-
-
Constructor Details
-
DNSJavaNameService
protected DNSJavaNameService()Creates a DNSJavaNameService instance.Uses the sun.net.spi.nameservice.nameservers, sun.net.spi.nameservice.domain, and java.net.preferIPv6Addresses properties for configuration.
-
-
Method Details
-
lookupAllHostAddr
Performs a forward DNS lookup for the host name.- Specified by:
lookupAllHostAddrin interfaceNameService- Parameters:
host- The host name to resolve.- Returns:
- All the ip addresses found for the host name.
- Throws:
UnknownHostException
-
getHostByAddr
Performs a reverse DNS lookup.- Specified by:
getHostByAddrin interfaceNameService- Parameters:
addr- The ip address to lookup.- Returns:
- The host name found for the ip address.
- Throws:
UnknownHostException
-