Class IpSet
- java.lang.Object
-
- ca.stellardrift.permissionsex.impl.util.IpSet
-
- All Implemented Interfaces:
Predicate<InetAddress>
public final class IpSet extends Object implements Predicate<InetAddress>
-
-
Field Summary
Fields Modifier and Type Field Description static org.spongepowered.configurate.serialize.TypeSerializer<IpSet>SERIALIZER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(IpSet other)booleancontains(InetAddress input)static IpSetfromAddrPrefix(InetAddress address, int prefixLen)Resolve an ip set from address and prefix lengthstatic IpSetfromCidr(String spec)Given a CIDR range, construct an IP set.static IpSetonly(InetAddress address)Create an IP set matching only one single address.booleantest(InetAddress address)StringtoString()Get the CIDR string representation of this IP set.
-
-
-
Field Detail
-
SERIALIZER
public static final org.spongepowered.configurate.serialize.TypeSerializer<IpSet> SERIALIZER
-
-
Method Detail
-
only
public static IpSet only(InetAddress address)
Create an IP set matching only one single address.- Parameters:
address- the address to match- Returns:
- a new ip set
-
fromAddrPrefix
public static IpSet fromAddrPrefix(InetAddress address, int prefixLen)
Resolve an ip set from address and prefix length- Parameters:
address- the IP addressprefixLen- the prefix length- Returns:
- a new ip set
- Throws:
IllegalArgumentException- if the prefix length is not valid for the provided address
-
fromCidr
public static IpSet fromCidr(String spec)
Given a CIDR range, construct an IP set.- Parameters:
spec- the specification- Returns:
- a parsed ip set matching the range
- Throws:
IllegalArgumentException- if the syntax is not valid for CIDR, or the prefix length is invalid.
-
test
public boolean test(InetAddress address)
- Specified by:
testin interfacePredicate<InetAddress>
-
contains
public boolean contains(InetAddress input)
-
-