Class CIDRBlock

java.lang.Object
org.deltava.util.CIDRBlock
All Implemented Interfaces:
Serializable

public class CIDRBlock extends Object implements Serializable
A class that enables to get an IP range from CIDR specification. It supports both IPv4 and IPv6.
See Also:
  • Constructor Details

    • CIDRBlock

      public CIDRBlock(String cidrAddr)
      Creates the CIDR block.
      Parameters:
      cidrAddr - the address in base/prefix format
    • CIDRBlock

      public CIDRBlock(String cidrAddr, int prefixLength)
      Creates the CIDR block.
      Parameters:
      cidrAddr - the base address
      prefixLength - the prefix length in bits
  • Method Details

    • isIPv6

      public boolean isIPv6()
    • getNetworkAddress

      public String getNetworkAddress()
    • getBroadcastAddress

      public String getBroadcastAddress()
    • getPrefixLength

      public int getPrefixLength()
    • isInRange

      public boolean isInRange(String ipAddress)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object