nl.mansoft
Class Utils

java.lang.Object
  extended by nl.mansoft.Utils

public class Utils
extends Object

The Utils class contains static utility methods for jipv6. Utils.


Method Summary
static InetAddress getByName(String hostName)
          Determines the IP address of a host, given the host's name.
static InetAddress getByNameXbill(String hostName)
          Determines the IPv6 address of a host, given the host's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getByNameXbill

public static InetAddress getByNameXbill(String hostName)
                                  throws UnknownHostException
Determines the IPv6 address of a host, given the host's name. This function only resolves non-literal IPv6 addresses by using the dnsjava library

Parameters:
hostName - the specified host, or null.
Returns:
an IP address for the given host name.
Throws:
UnknownHostException - if no IP address for the hostName could be found, or if a scope_id was specified for a global IPv6 address.
SecurityException - if a security manager exists and its checkConnect method doesn't allow the operation

getByName

public static InetAddress getByName(String hostName)
                             throws UnknownHostException
Determines the IP address of a host, given the host's name. This implementation of Inetaddress.getByName also resolves IPv6 addresses when no IPv6 global address is available by using the dnsjava library. Below the documentation of InetAddress.getByName(String hostName)

The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.

For host specified in literal IPv6 address, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. IPv6 scoped addresses are also supported. See here for a description of IPv6 scoped addresses.

If the host is null then an InetAddress representing an address of the loopback interface is returned. See RFC 3330 section 2 and RFC 2373 section 2.5.3.

Parameters:
hostName - the specified host, or null.
Returns:
an IP address for the given host name.
Throws:
UnknownHostException - if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.
SecurityException - if a security manager exists and its checkConnect method doesn't allow the operation