public class IPv4Address extends IPAddress<IPv4Address> implements Writeable
| Modifier and Type | Field and Description |
|---|---|
static IPv4Address |
FULL_MASK |
static IPv4Address |
NO_MASK |
static IPv4Address |
NONE |
static org.projectfloodlight.openflow.types.IPv4Address.Reader |
READER |
| Modifier and Type | Method and Description |
|---|---|
IPv4Address |
and(IPv4Address other)
Perform a low level AND operation on the bits of two IPAddress objects
|
IPv4Address |
applyMask(IPv4Address mask) |
int |
asCidrMaskLength()
If this IPAddress represents a valid CIDR style netmask (see
isCidrMask()) returns the length of the prefix (the number of "1" bits).
|
int |
compareTo(IPv4Address o) |
boolean |
equals(Object obj) |
byte[] |
getBytes()
Returns the raw IP address of this
IPAddress object. |
int |
getInt() |
IPVersion |
getIpVersion()
Returns the Internet Protocol (IP) version of this object
|
int |
getLength() |
int |
hashCode() |
boolean |
isBroadcast()
Checks if the IPAddress is the global broadcast address
255.255.255.255 in case of IPv4
|
boolean |
isCidrMask()
Checks if this IPAddress represents a valid CIDR style netmask, i.e.,
it has a set of leading "1" bits followed by only "0" bits
|
boolean |
isMulticast()
IPv4 multicast addresses are defined by the leading address bits of 1110
|
IPv4Address |
not()
Returns a new IPAddress object with the bits inverted
|
static IPv4Address |
of(byte[] address)
Returns an
IPv4Address object that represents the given
IP address. |
static IPv4Address |
of(Inet4Address address)
Returns an
IPv4Address object that represents the given
IP address. |
static IPv4Address |
of(int raw)
Returns an
IPv4Address object that represents the given
IP address. |
static IPv4Address |
of(String string)
Returns an
IPv4Address object that represents the given
IP address. |
static IPv4Address |
ofCidrMaskLength(int cidrMaskLength)
Returns an
IPv4Address object that represents the
CIDR subnet mask of the given prefix length. |
IPv4Address |
or(IPv4Address other)
Perform a low level OR operation on the bits of two IPAddress objects
|
void |
putTo(com.google.common.hash.PrimitiveSink sink) |
static IPv4Address |
read4Bytes(org.jboss.netty.buffer.ChannelBuffer c) |
String |
toString() |
IPv4AddressWithMask |
withMask(IPv4Address mask)
Returns an
IPv4AddressWithMask object that represents this
IP address masked by the given IP address mask. |
IPv4AddressWithMask |
withMaskOfLength(int cidrMaskLength)
Returns an
IPv4AddressWithMask object that represents this
IP address masked by the CIDR subnet mask of the given prefix length. |
void |
write4Bytes(org.jboss.netty.buffer.ChannelBuffer c) |
void |
writeTo(org.jboss.netty.buffer.ChannelBuffer bb) |
fromInetAddress, ofpublic static final IPv4Address NONE
public static final IPv4Address NO_MASK
public static final IPv4Address FULL_MASK
public static final org.projectfloodlight.openflow.types.IPv4Address.Reader READER
public IPVersion getIpVersion()
IPAddressgetIpVersion in class IPAddress<IPv4Address>public boolean isCidrMask()
IPAddressisCidrMask in class IPAddress<IPv4Address>public int asCidrMaskLength()
IPAddressasCidrMaskLength in class IPAddress<IPv4Address>public boolean isBroadcast()
IPAddressisBroadcast in class IPAddress<IPv4Address>public boolean isMulticast()
isMulticast in class IPAddress<IPv4Address>public IPv4Address and(IPv4Address other)
IPAddressand in class IPAddress<IPv4Address>other - IPAddresspublic IPv4Address or(IPv4Address other)
IPAddressor in class IPAddress<IPv4Address>other - IPAddresspublic IPv4Address not()
IPAddressnot in class IPAddress<IPv4Address>@Nonnull public static IPv4Address of(@Nonnull byte[] address)
IPv4Address object that represents the given
IP address. The argument is in network byte order: the highest
order byte of the address is in address[0].
The address byte array must be 4 bytes long (32 bits long).
Similar to InetAddress.getByAddress(byte[]).
address - the raw IP address in network byte orderIPv4Address object that represents the given
raw IP addressNullPointerException - if the given address was nullIllegalArgumentException - if the given address was of an invalid
byte array lengthInetAddress.getByAddress(byte[])@Nonnull public static IPv4Address of(int raw)
IPv4Address object that represents the given
IP address.raw - the raw IP address represented as a 32-bit integerIPv4Address object that represents the given
raw IP address@Nonnull public static IPv4Address of(@Nonnull String string) throws IllegalArgumentException
IPv4Address object that represents the given
IP address. The argument is in the canonical quad-dotted notation.
For example, 1.2.3.4.string - the IP address in the canonical quad-dotted notationIPv4Address object that represents the given
IP addressNullPointerException - if the given string was nullIllegalArgumentException - if the given string was not a valid
IPv4 address@Nonnull public static IPv4Address of(@Nonnull Inet4Address address)
IPv4Address object that represents the given
IP address. The argument is given as an Inet4Address object.address - the IP address as an Inet4Address objectIPv4Address object that represents the
given IP addressNullPointerException - if the given Inet4Address was
null@Nonnull public static IPv4Address ofCidrMaskLength(int cidrMaskLength)
IPv4Address object that represents the
CIDR subnet mask of the given prefix length.cidrMaskLength - the prefix length of the CIDR subnet mask
(i.e. the number of leading one-bits),
where 0 <= cidrMaskLength <= 32IPv4Address object that represents the
CIDR subnet mask of the given prefix lengthIllegalArgumentException - if the given prefix length was invalid@Nonnull public IPv4AddressWithMask withMask(@Nonnull IPv4Address mask)
IPv4AddressWithMask object that represents this
IP address masked by the given IP address mask.withMask in class IPAddress<IPv4Address>mask - the IPv4Address object that represents the maskIPv4AddressWithMask object that represents this
IP address masked by the given maskNullPointerException - if the given mask was null@Nonnull public IPv4AddressWithMask withMaskOfLength(int cidrMaskLength)
IPv4AddressWithMask object that represents this
IP address masked by the CIDR subnet mask of the given prefix length.withMaskOfLength in class IPAddress<IPv4Address>cidrMaskLength - the prefix length of the CIDR subnet mask
(i.e. the number of leading one-bits),
where 0 <= cidrMaskLength <= 32IPv4AddressWithMask object that
represents this IP address masked by the CIDR
subnet mask of the given prefix lengthIllegalArgumentException - if the given prefix length was invalidofCidrMaskLength(int)public int getInt()
public byte[] getBytes()
IPAddressIPAddress object. The result
is in network byte order: the highest order byte of the address is in
getBytes()[0].
Similar to InetAddress.getAddress()
getBytes in class IPAddress<IPv4Address>InetAddress.getAddress()public int getLength()
getLength in interface OFValueType<IPv4Address>public String toString()
toString in class IPAddress<IPv4Address>public void write4Bytes(org.jboss.netty.buffer.ChannelBuffer c)
public static IPv4Address read4Bytes(org.jboss.netty.buffer.ChannelBuffer c)
public IPv4Address applyMask(IPv4Address mask)
applyMask in interface OFValueType<IPv4Address>public int hashCode()
hashCode in class IPAddress<IPv4Address>public boolean equals(Object obj)
equals in class IPAddress<IPv4Address>public int compareTo(IPv4Address o)
compareTo in interface Comparable<IPv4Address>public void putTo(com.google.common.hash.PrimitiveSink sink)
putTo in interface PrimitiveSinkableCopyright © 2016. All rights reserved.