org.sapia.ubik.util
Class Localhost

java.lang.Object
  extended by org.sapia.ubik.util.Localhost

public class Localhost
extends java.lang.Object

This class provides a utility method that can be used to retrieve the IP address of this host.

This class internaly uses the NetworkInterface class to retrieve that address. If an address can't be found that way, the following code is used:

 InetAddress.getLocalHost()
 
The above code is know to return 0.0.0.0 or the loopback address under some Linux distributions, which is what this class first attempts to use the NetworkInterface.

Author:
yduchesne

Constructor Summary
Localhost()
           
 
Method Summary
static java.net.InetAddress getAnyLocalAddress()
           
static java.net.InetAddress getLocalAddress()
          Deprecated. Should method getAnyLocalAddress() instead.
static boolean isIpPatternDefined()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Localhost

public Localhost()
Method Detail

isIpPatternDefined

public static boolean isIpPatternDefined()

getLocalAddress

public static java.net.InetAddress getLocalAddress()
                                            throws java.net.UnknownHostException
Deprecated. Should method getAnyLocalAddress() instead.

Returns:
Throws:
java.net.UnknownHostException

getAnyLocalAddress

public static java.net.InetAddress getAnyLocalAddress()
                                               throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException


Copyright © 2010 Sapia OSS. All Rights Reserved.