OpenNMS API 1.2.3

org.opennms.netmgt.utils
Class IPSorter

java.lang.Object
  extended byorg.opennms.netmgt.utils.IPSorter

public class IPSorter
extends java.lang.Object

Convenience class for retrieving the lowest, highest IP address in a given list.


Constructor Summary
IPSorter()
           
 
Method Summary
(package private) static long byteToLong(byte b)
           Converts an 8-bit byte to a 64-bit long integer.
static long convertToLong(byte[] addr)
           The convertToLong method takes an array of bytes and shifts them into a long value.
static long convertToLong(java.lang.String ipAddressString)
          This method is used to convert a dotted decimal IP address composed of four octets into a long value.
static java.net.InetAddress getLowestInetAddress(java.net.InetAddress[] addresses)
          Given a list of IP addresses, return the lowest as determined by the numeric representation and not the alphanumeric string.
static java.net.InetAddress getLowestInetAddress(java.util.List addresses)
          Given a list of IP addresses, return the lowest as determined by the numeric representation and not the alphanumeric string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPSorter

public IPSorter()
Method Detail

byteToLong

static long byteToLong(byte b)

Converts an 8-bit byte to a 64-bit long integer. If the quantity is a sign extended negative number then the value of 256 is added to wrap the conversion into the range of [0..255].

Parameters:
b - The byte to convert
Returns:
The converted 64-bit unsigned value.

convertToLong

public static long convertToLong(byte[] addr)

The convertToLong method takes an array of bytes and shifts them into a long value. The bytes at the front of the array are shifted into the MSB of the long as each new byte is added to the LSB of the long. if the array is of sufficent size the first bytes of the array may be shifted out of the returned long.

Parameters:
addr - The array to convert to a long.
Returns:
The created long value.
Throws:
java.lang.IllegalArgumentException - Thrown if the addr parameter is null.

convertToLong

public static long convertToLong(java.lang.String ipAddressString)
This method is used to convert a dotted decimal IP address composed of four octets into a long value. The long is returned in network byte order so that it can be compared using simple equality operators.

Parameters:
ipAddressString - The dotted decimal address string to convert
Returns:
The created long value
Throws:
java.lang.IllegalArgumentException - Thrown if the ipAddressString parameter is null.

getLowestInetAddress

public static java.net.InetAddress getLowestInetAddress(java.net.InetAddress[] addresses)
Given a list of IP addresses, return the lowest as determined by the numeric representation and not the alphanumeric string.


getLowestInetAddress

public static java.net.InetAddress getLowestInetAddress(java.util.List addresses)
Given a list of IP addresses, return the lowest as determined by the numeric representation and not the alphanumeric string.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.