Class IPRange


  • public class IPRange
    extends Object
    This class represents an IP Range, which are represented by an IP address and and a subnet mask. The standards describing modern routing protocols often refer to the extended-network-prefix-length rather than the subnet mask. The prefix length is equal to the number of contiguous one-bits in the traditional subnet mask. This means that specifying the network address 130.5.5.25 with a subnet mask of 255.255.255.0 can also be expressed as 130.5.5.25/24. The prefix-length notation is more compact and easier to understand than writing out the mask in its traditional dotted-decimal format.
    Version:
    1.0
    Author:
    Marcel Dullaart
    See Also:
    IPAddress
    • Constructor Detail

      • IPRange

        public IPRange​(String range)
    • Method Detail

      • getIPAddress

        public final IPAddress getIPAddress()
        Return the encapsulated IP address.
        Returns:
        The IP address.
      • getIPSubnetMask

        public final IPAddress getIPSubnetMask()
        Return the encapsulated subnet mask
        Returns:
        The IP range's subnet mask.
      • getExtendedNetworkPrefix

        public final int getExtendedNetworkPrefix()
        Return the extended extended network prefix.
        Returns:
        Return the extended network prefix.
      • toString

        public String toString()
        Convert the IP Range into a string representation.
        Overrides:
        toString in class Object
        Returns:
        Return the string representation of the IP Address following the common format xxx.xxx.xxx.xxx/xx (IP address/extended network prefixs).
      • toDecimalString

        public static String toDecimalString​(String inBinaryIpAddress)
      • isIPAddressInRange

        public boolean isIPAddressInRange​(IPAddress address)
        Check if the specified IP address is in the encapsulated range.
        Parameters:
        address - The IP address to be tested.
        Returns:
        Return true if the specified IP address is in the encapsulated IP range, otherwise return false.