org.dhcp4java
Class Util

java.lang.Object
  extended by org.dhcp4java.Util

public final class Util
extends java.lang.Object


Method Summary
static int inetAddress2Int(java.net.InetAddress addr)
          Converts IPv4 InetAddress to 32 bits int.
static long inetAddress2Long(java.net.InetAddress addr)
          Converts IPv4 InetAddress to 32 bits int, packages into a 64 bits long.
static java.net.InetAddress int2InetAddress(int val)
          Converts 32 bits int to IPv4 InetAddress.
static java.net.InetAddress long2InetAddress(long val)
          Converts 32 bits int packaged into a 64bits long to IPv4 InetAddress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

int2InetAddress

public static final java.net.InetAddress int2InetAddress(int val)
Converts 32 bits int to IPv4 InetAddress.

Parameters:
val - int representation of IPv4 address
Returns:
the address object

long2InetAddress

public static final java.net.InetAddress long2InetAddress(long val)
Converts 32 bits int packaged into a 64bits long to IPv4 InetAddress.

Parameters:
val - int representation of IPv4 address
Returns:
the address object

inetAddress2Int

public static final int inetAddress2Int(java.net.InetAddress addr)
Converts IPv4 InetAddress to 32 bits int.

Parameters:
addr - IPv4 address object
Returns:
32 bits int
Throws:
java.lang.NullPointerException - addr is null.
java.lang.IllegalArgumentException - the address is not IPv4 (Inet4Address).

inetAddress2Long

public static final long inetAddress2Long(java.net.InetAddress addr)
Converts IPv4 InetAddress to 32 bits int, packages into a 64 bits long.

Parameters:
addr - IPv4 address object
Returns:
32 bits int
Throws:
java.lang.NullPointerException - addr is null.
java.lang.IllegalArgumentException - the address is not IPv4 (Inet4Address).