Interface INameService
- All Superinterfaces:
InvocationHandler
- All Known Implementing Classes:
ArqCubeNameService
Provides an invocation handler to register a DNS service
See https://stackoverflow.com/questions/11647629/how-to-configure-hostname-resolution-to-use-a-custom-dns-server-in-java
-
Method Summary
Modifier and TypeMethodDescriptiongetHostByAddr(byte[] addr) Lookup the host corresponding to the IP address providedstatic voidinstall(INameService dns) default ObjectlookupAllHostAddr(String host) Lookup a host mapping by name.
-
Method Details
-
install
static void install(INameService dns) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException -
lookupAllHostAddr
Lookup a host mapping by name. Retrieve the IP addresses associated with a host- Parameters:
host- the specified hostname- Returns:
- array of IP addresses for the requested host
- Throws:
UnknownHostException- if no IP address for thehostcould be found
-
getHostByAddr
Lookup the host corresponding to the IP address provided- Parameters:
addr- byte array representing an IP address- Returns:
Stringrepresenting the host name mapping- Throws:
UnknownHostException- if no host found for the specified IP address
-
invoke
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-