org.opennms.netmgt.model.discovery
Class IPAddrRange

java.lang.Object
  extended by org.opennms.netmgt.model.discovery.IPAddrRange
All Implemented Interfaces:
Iterable<InetAddress>

public final class IPAddrRange
extends Object
implements Iterable<InetAddress>

The IPAddressRange object is used to encapsulate the starting and ending points of a continguous IPv4 Address range. The class can then generate either an Enumeration or Iterator that can be used to cycle through the range of addresses by the object's user.

Author:
Sowmya , Brian Weaver , OpenNMS

Method Summary
static long convertToLong(byte[] addr)
          Deprecated. Use org.opennms.netmgt.utils.IPSorter.convertToLong() instead.
 Iterator<InetAddress> iterator()
           Returns an Iterator object that can be used to step through all the address encapsulated in the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

iterator

public Iterator<InetAddress> iterator()

Returns an Iterator object that can be used to step through all the address encapsulated in the object.

The iterator returns objects of type InetAddressor null if the address is unknown.

Specified by:
iterator in interface Iterable<InetAddress>
See Also:
InetAddress

convertToLong

public static long convertToLong(byte[] addr)
Deprecated. Use org.opennms.netmgt.utils.IPSorter.convertToLong() instead.

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:
IllegalArgumentException - Thrown if the addr parameter is null.


Copyright © 2009. All Rights Reserved.