org.ipdr.utils
Class MacAddressUtil

java.lang.Object
  extended by org.ipdr.utils.MacAddressUtil

public class MacAddressUtil
extends java.lang.Object

This class contains the convert methods of MAC Address. The convert methods are to convert from String to Long and from Long to String.


Constructor Summary
MacAddressUtil()
           
 
Method Summary
static long convertToMACLong(java.lang.String macAdd)
          This method takes the MAC Address string format as per pattern in the specifications (11-12-21-33-1a-e2) as input and converts it into Long.
static java.lang.String convertToMACString(long macAdd)
          Generates a printable string containing the byte array in the standard IPv6 Address format.
static void validateMACAddress(java.lang.String macAdd)
          This method will validate whether the input IP Address is in proper format for IPv6.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacAddressUtil

public MacAddressUtil()
Method Detail

convertToMACLong

public static long convertToMACLong(java.lang.String macAdd)
                             throws IPDRException
This method takes the MAC Address string format as per pattern in the specifications (11-12-21-33-1a-e2) as input and converts it into Long.

Parameters:
macAdd - MAC Address in String format
Returns:
Byte array equivalent
Throws:
IPDRException

convertToMACString

public static java.lang.String convertToMACString(long macAdd)
                                           throws IPDRException
Generates a printable string containing the byte array in the standard IPv6 Address format.

Parameters:
macAdd - 16 byte array containing a valid IPv6 Address.
Returns:
The IPv6 Address in the standard printable (colon) format.
Throws:
IPDRException

validateMACAddress

public static void validateMACAddress(java.lang.String macAdd)
                               throws IPDRException
This method will validate whether the input IP Address is in proper format for IPv6.

Parameters:
macAdd - IP Address to be validated in Hexadecimal String
Throws:
IPDRException