Package org.forgerock.openig.util
Class InetAddressMask
- java.lang.Object
-
- org.forgerock.openig.util.InetAddressMask
-
- All Implemented Interfaces:
Predicate<InetAddress>
public final class InetAddressMask extends Object implements Predicate<InetAddress>
Matches IPs (v4 or v6) with a CIDR pattern RFC4632.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InetAddressMask
fromCidrPattern(String cidrPattern)
Build an address mask from a CIDR formatted string.static List<InetAddressMask>
fromCidrPatterns(List<String> cidrPatterns)
Build a list of address masks from a list of CIDR pattern.boolean
test(InetAddress ipAddress)
String
toString()
-
-
-
Method Detail
-
fromCidrPattern
public static InetAddressMask fromCidrPattern(String cidrPattern)
Build an address mask from a CIDR formatted string.- Parameters:
cidrPattern
- The CIDR pattern (example: "127.0.0.1/12"). Must not be null.- Returns:
- the corresponding InetAddressMask.
-
fromCidrPatterns
public static List<InetAddressMask> fromCidrPatterns(List<String> cidrPatterns)
Build a list of address masks from a list of CIDR pattern.- Parameters:
cidrPatterns
- the CIDR pattern list.- Returns:
- The corresponding InetAddressMask list.
-
test
public boolean test(InetAddress ipAddress)
- Specified by:
test
in interfacePredicate<InetAddress>
-
-