Package com.pingidentity.sdk
Class CIDRUtils
java.lang.Object
com.pingidentity.sdk.CIDRUtils
A utility class that provides address evaluation (network and broadcast) and in-range functionality for a given
IP Address from a CIDR specification. This utility supports both IPv4 and IPv6 addresses.
IPv4 Example
10.77.12.11/18 would produce 10.77.0.0 for the networkAddress and 10.77.63.255 for the broadcastAddress.
IPv5 Example
435:23f::45:23/101
would produce 435:23f:0:0:0:0:0:0 for the networkAddress and 435:23f:0:0:0:0:7ff:ffff for the broadcastAddress.
- Since:
- 8.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the Broadcast Address from the provided CIDR specification.Return the Network Address from the provided CIDR specification.booleanReturn whether an IP Address is within the provided CIDR specification.toString()Return a string representation of the CIDR specification consisting of the start and end addresses.
-
Constructor Details
-
CIDRUtils
Constructor for the CIDRUtils utility class.- Parameters:
cidr- The CIDR specification to be evaluated.- Throws:
UnknownHostException
-
-
Method Details
-
getNetworkAddress
Return the Network Address from the provided CIDR specification.- Returns:
- the Network Address.
-
getBroadcastAddress
Return the Broadcast Address from the provided CIDR specification.- Returns:
- the Broadcast Address.
-
isInRange
Return whether an IP Address is within the provided CIDR specification.- Returns:
- true if the IP Address is in range of the CIDR specification.
- Throws:
UnknownHostException
-
toString
Return a string representation of the CIDR specification consisting of the start and end addresses.
-