Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.net
Class DNS

    java.lang.Object
      org.apache.hadoop.net.DNS

    public class DNS

extends Object

A class that provides direct and reverse lookup functionalities, allowing the querying of specific network interfaces or nameservers.

Constructor Summary
`DNS()`

Method Summary
`static String` | `getDefaultHost(String strInterface)` Returns the default (first) host name associated by the default nameserver with the address bound to the specified network interface
`static String` | `getDefaultHost(String strInterface, String nameserver)` Returns the default (first) host name associated by the provided nameserver with the address bound to the specified network interface
`static String` | `getDefaultIP(String strInterface)` Returns the first available IP address associated with the provided network interface
`static String[]` | `getHosts(String strInterface)` Returns all the host names associated by the default nameserver with the address bound to the specified network interface
`static String[]` | `getHosts(String strInterface, String nameserver)` Returns all the host names associated by the provided nameserver with the address bound to the specified network interface
`static String[]` | `getIPs(String strInterface)` Returns all the IPs associated with the provided interface, if any, in textual form.
`static String` | `reverseDns(InetAddress hostIp, String ns)` Returns the hostname associated with the specified IP address by the provided nameserver.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DNS

    public DNS()

Method Detail

### reverseDns

    public static String reverseDns(InetAddress hostIp,
                                    String ns)
                             throws NamingException

  Returns the hostname associated with the specified IP address by the provided nameserver.

  Parameters:
    `hostIp` - The address to reverse lookup
    `ns` - The host name of a reachable DNS server
  Returns:
    The host name associated with the provided IP
  Throws:
    `NamingException` - If a NamingException is encountered

### getIPs

    public static String[] getIPs(String strInterface)
                           throws UnknownHostException

  Returns all the IPs associated with the provided interface, if any, in textual form.

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
  Returns:
    A string vector of all the IPs associated with the provided interface
  Throws:
    `UnknownHostException` - If an UnknownHostException is encountered in querying the default interface

### getDefaultIP

    public static String getDefaultIP(String strInterface)
                               throws UnknownHostException

  Returns the first available IP address associated with the provided network interface

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
  Returns:
    The IP address in text form
  Throws:
    `UnknownHostException` - If one is encountered in querying the default interface

### getHosts

    public static String[] getHosts(String strInterface,
                                    String nameserver)
                             throws UnknownHostException

  Returns all the host names associated by the provided nameserver with the address bound to the specified network interface

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
    `nameserver` - The DNS host name
  Returns:
    A string vector of all host names associated with the IPs tied to the specified interface
  Throws:
    `UnknownHostException`

### getHosts

    public static String[] getHosts(String strInterface)
                             throws UnknownHostException

  Returns all the host names associated by the default nameserver with the address bound to the specified network interface

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
  Returns:
    The list of host names associated with IPs bound to the network interface
  Throws:
    `UnknownHostException` - If one is encountered while querying the deault interface

### getDefaultHost

    public static String getDefaultHost(String strInterface,
                                        String nameserver)
                                 throws UnknownHostException

  Returns the default (first) host name associated by the provided nameserver with the address bound to the specified network interface

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
    `nameserver` - The DNS host name
  Returns:
    The default host names associated with IPs bound to the network interface
  Throws:
    `UnknownHostException` - If one is encountered while querying the deault interface

### getDefaultHost

    public static String getDefaultHost(String strInterface)
                                 throws UnknownHostException

  Returns the default (first) host name associated by the default nameserver with the address bound to the specified network interface

  Parameters:
    `strInterface` - The name of the network interface to query (e.g. eth0)
  Returns:
    The default host name associated with IPs bound to the network interface
  Throws:
    `UnknownHostException` - If one is encountered while querying the deault interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation