org.xbill.DNS
Class Address

java.lang.Object
  extended byorg.xbill.DNS.Address

public final class Address
extends Object

Routines dealing with IP addresses. Includes functions similar to those in the java.net.InetAddress class.

Author:
Brian Wellington

Method Summary
static InetAddress[] getAllByName(String name)
          Determines all IP address of a host
static InetAddress getByName(String name)
          Determines the IP address of a host
static String getHostName(InetAddress addr)
          Determines the hostname for an address
static boolean isDottedQuad(String s)
          Determines if a string contains a valid IP address.
static int[] toArray(String s)
          Convert a string containing an IP address to an array of 4 integers.
static String toDottedQuad(byte[] addr)
          Converts a byte array containing an IPv4 address into a dotted quad string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toArray

public static int[] toArray(String s)
Convert a string containing an IP address to an array of 4 integers.

Parameters:
s - The string
Returns:
The address

isDottedQuad

public static boolean isDottedQuad(String s)
Determines if a string contains a valid IP address.

Parameters:
s - The string
Returns:
Whether the string contains a valid IP address

toDottedQuad

public static String toDottedQuad(byte[] addr)
Converts a byte array containing an IPv4 address into a dotted quad string.

Parameters:
addr - The byte array
Returns:
The string representation

getByName

public static InetAddress getByName(String name)
                             throws UnknownHostException
Determines the IP address of a host

Parameters:
name - The hostname to look up
Returns:
The first matching IP address
Throws:
UnknownHostException - The hostname does not have any addresses

getAllByName

public static InetAddress[] getAllByName(String name)
                                  throws UnknownHostException
Determines all IP address of a host

Parameters:
name - The hostname to look up
Returns:
All matching IP addresses
Throws:
UnknownHostException - The hostname does not have any addresses

getHostName

public static String getHostName(InetAddress addr)
                          throws UnknownHostException
Determines the hostname for an address

Parameters:
addr - The address to look up
Returns:
The associated host name
Throws:
UnknownHostException - There is no hostname for the address