Package com.linecorp.armeria.common.util
Class InetAddressPredicates
- java.lang.Object
-
- com.linecorp.armeria.common.util.InetAddressPredicates
-
public final class InetAddressPredicates extends Object
A utility class which provides factory methods in order to easily create aPredicate
of anInetAddress
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Predicate<InetAddress>
ofCidr(String cidr)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate<InetAddress>
ofCidr(InetAddress baseAddress, int maskBits)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate<InetAddress>
ofCidr(InetAddress baseAddress, String subnetMask)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate<InetAddress>
ofExact(String address)
static Predicate<InetAddress>
ofExact(InetAddress address)
-
-
-
Method Detail
-
ofExact
public static Predicate<InetAddress> ofExact(InetAddress address)
- Parameters:
address
- the expectedInetAddress
-
ofExact
public static Predicate<InetAddress> ofExact(String address)
- Parameters:
address
- the expected IP address string, e.g.10.0.0.1
-
ofCidr
public static Predicate<InetAddress> ofCidr(InetAddress baseAddress, int maskBits)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
baseAddress
- the baseInetAddress
of a CIDR notationmaskBits
- the number of significant bits which describes its network portion
-
ofCidr
public static Predicate<InetAddress> ofCidr(InetAddress baseAddress, String subnetMask)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
baseAddress
- the baseInetAddress
of a CIDR notationsubnetMask
- the subnet mask, e.g.255.255.255.0
-
ofCidr
public static Predicate<InetAddress> ofCidr(String cidr)
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
cidr
- the CIDR notation of an address block, e.g.10.0.0.0/8
,192.168.1.0/24
,1080:0:0:0:8:800:200C:4100/120
-
-