Package org.elasticsearch.common.network
Class Cidrs
- java.lang.Object
-
- org.elasticsearch.common.network.Cidrs
-
public final class Cidrs extends java.lang.Object
-
-
Method Summary
Modifier and Type Method Description static long[]
cidrMaskToMinMax(java.lang.String cidr)
Parses an IPv4 address block in CIDR notation into a pair of longs representing the bottom and top of the address blockstatic java.lang.String
createCIDR(long ipAddress, int networkMask)
-
-
-
Method Detail
-
cidrMaskToMinMax
public static long[] cidrMaskToMinMax(java.lang.String cidr)
Parses an IPv4 address block in CIDR notation into a pair of longs representing the bottom and top of the address block- Parameters:
cidr
- an address block in CIDR notation a.b.c.d/n- Returns:
- array representing the address block
- Throws:
java.lang.IllegalArgumentException
- if the cidr can not be parsed
-
createCIDR
public static java.lang.String createCIDR(long ipAddress, int networkMask)
-
-