jgroup.util
Class Network

java.lang.Object
  extended by jgroup.util.Network

public class Network
extends java.lang.Object

Utility class for obtaining the local host.

Since:
Jgroup 1.2
Author:
Alberto Montresor, Hein Meling

Constructor Summary
Network()
           
 
Method Summary
static java.lang.String getLocalDomainName()
          Returns the domain name of the local host; not including the machine name part.
static java.net.InetAddress getLocalHost()
          Returns the internet address of the local host.
static java.lang.String getLocalHostName()
          Returns the hostname of the local host; may include the fully qualified domain name.
static java.lang.String getLocalMachineName()
          Returns the machine name of the local host; not including the fully qualified domain name.
static java.lang.String getMachineName(java.lang.String hostName)
          Returns the machine name of the given host; not including the fully qualified domain name.
static boolean isLocal(java.net.InetAddress address)
          Returns true if the specified address is the local host; false is returned otherwise.
static boolean isLocal(int packedAddress)
          Returns true if the specified packedAddress is the local host; false is returned otherwise.
static int translate(java.net.InetAddress address)
          Returns an integer representation of the specified InetAddress.
static java.net.InetAddress translate(int packed)
          Returns an InetAddress representation of the specified integer.
static int translateToInt(java.lang.String address)
          Returns an integer representation of the specified String IP-address.
static java.lang.String translateToString(int packed)
          Returns a String representation of the IP-address for the specified integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Network

public Network()
Method Detail

getLocalHost

public static java.net.InetAddress getLocalHost()
Returns the internet address of the local host.


getLocalHostName

public static java.lang.String getLocalHostName()
Returns the hostname of the local host; may include the fully qualified domain name.


getLocalMachineName

public static java.lang.String getLocalMachineName()
Returns the machine name of the local host; not including the fully qualified domain name.


getMachineName

public static java.lang.String getMachineName(java.lang.String hostName)
Returns the machine name of the given host; not including the fully qualified domain name.


getLocalDomainName

public static java.lang.String getLocalDomainName()
Returns the domain name of the local host; not including the machine name part.


isLocal

public static boolean isLocal(java.net.InetAddress address)
Returns true if the specified address is the local host; false is returned otherwise.


isLocal

public static boolean isLocal(int packedAddress)
Returns true if the specified packedAddress is the local host; false is returned otherwise.


translate

public static int translate(java.net.InetAddress address)
Returns an integer representation of the specified InetAddress. This is used for efficiency.


translate

public static java.net.InetAddress translate(int packed)
                                      throws java.net.UnknownHostException
Returns an InetAddress representation of the specified integer. This is used for performance improvements in serialization.

Parameters:
packed - An integer representation of an internet address.
Returns:
The corresponding InetAddress representation.
Throws:
java.net.UnknownHostException - If the specified integer does not correspond to a known host.

translateToInt

public static int translateToInt(java.lang.String address)
                          throws java.net.UnknownHostException
Returns an integer representation of the specified String IP-address. This is used for efficiency.

Throws:
java.net.UnknownHostException

translateToString

public static java.lang.String translateToString(int packed)
Returns a String representation of the IP-address for the specified integer.

Parameters:
packed - An integer representation of an internet address.
Returns:
The corresponding InetAddress representation.


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.