|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.net.Cidr
public class Cidr
represents a CIDR (classless inter-domain routing) token, i.e. 10.0.0.0/8 or 192.168.4.0/24
Field Summary | |
---|---|
static Cidr |
CLASS_A
|
static Cidr |
CLASS_B
|
static Cidr |
CLASS_C
|
static Cidr |
LINK_LOCAL
|
static Cidr |
LOOPBACK
|
static java.util.List |
NON_PUBLIC_CIDRS
|
static java.util.List |
PRIVATE_NETWORKS_RFC_1918
|
static Cidr |
UNIVERSAL
|
static Cidr |
_10
|
static Cidr |
_127
|
static Cidr |
_169_254
|
static Cidr |
_172_16
|
static Cidr |
_192_168
|
Constructor Summary | |
Cidr(java.lang.String cidr)
|
|
Cidr(int... unsignedBytes)
allows creation as Cidr(192, 168) for 192.168.0.0/16; zero bits or ints included are significant, i.e. |
|
Cidr(int[] subnetBytes, int length)
|
Method Summary | |
---|---|
java.net.InetAddress
|
addressAtOffset(int offset)
taking the addresses in the CIDR in order, returns the one in the offset^th position (starting with the CIDR itself, even if final bits are 0) |
BitList
|
asBitList()
returns list of bits for the significant (length) bits of this CIDR |
Cidr
|
commonPrefix(Cidr other)
|
int
|
commonPrefixLength(Cidr other)
returns length of the prefix in common between the two cidrs |
boolean
|
contains(Cidr target)
|
boolean
|
equals(java.lang.Object obj)
|
int[]
|
getBytes()
|
int
|
getLength()
|
int
|
hashCode()
|
static boolean
|
isCanonical(java.lang.String cidr)
returns true iff this CIDR is well-formed and canonical, i.e. 4 dot-separated bytes followed by a slash and a length, where length is <= 32, and the preceding 4 bytes don't include any 1 bits beyond the indicated length; e.g. 10.0.0.0/8 -- but not 10.0.0.1/8 or 10.../8 (although the latter ones are accepted by the constructor and converted to the canonical CIDR) |
java.net.InetAddress
|
netmask()
returns the netmask for this cidr; e.g. for a /24 cidr returns 255.255.255.0 |
Cidr
|
subnet(int... extraUnsignedBytes)
|
java.lang.String
|
toString()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final Cidr CLASS_A
public static final Cidr CLASS_B
public static final Cidr CLASS_C
public static final Cidr LINK_LOCAL
public static final Cidr LOOPBACK
public static final java.util.List NON_PUBLIC_CIDRS
public static final java.util.List PRIVATE_NETWORKS_RFC_1918
public static final Cidr UNIVERSAL
public static final Cidr _10
public static final Cidr _127
public static final Cidr _169_254
public static final Cidr _172_16
public static final Cidr _192_168
Constructor Detail |
---|
public Cidr(java.lang.String cidr)
public Cidr(int... unsignedBytes)
public Cidr(int[] subnetBytes, int length)
Method Detail |
---|
public java.net.InetAddress addressAtOffset(int offset)
public BitList asBitList()
public Cidr commonPrefix(Cidr other)
public int commonPrefixLength(Cidr other)
public boolean contains(Cidr target)
@Override public boolean equals(java.lang.Object obj)
public int[] getBytes()
public int getLength()
@Override public int hashCode()
public static boolean isCanonical(java.lang.String cidr)
public java.net.InetAddress netmask()
public Cidr subnet(int... extraUnsignedBytes)
@Override public java.lang.String toString()
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.