|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.protocols.ip.IPv4Address
Represents an Internet Protocol version 4 address. An IPv4 address is a 32-bit address that can be considered four eight bit octets. Each octet represents a number in the range of [0..256). A string representation is a dotted decimal address in the form of "xxx.xxx.xxx.xxx" where xxx is a single octet. The main purpose of the class is to represent an IPv4 Address without the associated lookup baggage in the java.net.InetAddress class.
Field Summary | |
private byte[] |
m_addr
|
(package private) static long |
serialVersionUID
|
Constructor Summary | |
IPv4Address()
Constructs a new IPv4Address object. |
|
IPv4Address(byte[] addr)
Constructs a new object based on the value stored in the passed array. |
|
IPv4Address(java.net.InetAddress addr)
Creates a new IPv4Address from the passed InetAddress object. |
|
IPv4Address(int ipv4Addr)
Constructs a new address object based on the 32-bit passed value. |
|
IPv4Address(IPv4Address second)
Constructs a new address object based upon the value of the first object. |
|
IPv4Address(java.lang.String ipv4Addr)
Creates a new object by decomposing the passed string into it four components. |
Method Summary | |
static java.lang.String |
addressToString(byte[] buf)
Converts the passed IPv4 address buffer to a dotted decimal IP address string. |
static java.lang.String |
addressToString(int ipv4Addr)
Converts the passed 32-bit IPv4 address to a dotted decimal IP address string. |
private static int |
byteToInt(byte b)
Converts a byte to an integer, treating the byte as unsigned. |
private byte[] |
dup(byte[] src)
Duplicates the array of bytes. |
boolean |
equals(java.lang.Object obj)
Test to determine if the passed object is equal to self. |
int |
getAddress()
Returns the 32-bit IPv4 address. |
byte[] |
getAddressBytes()
Returns the IPv4 address in the form of an array of 4 bytes |
void |
setAddress(byte[] addr)
Sets the object based on the value stored in the passed array. |
void |
setAddress(java.net.InetAddress addr)
Sets the IPv4Address from the passed InetAddress object. |
void |
setAddress(int ipv4Addr)
Sets the address object based on the 32-bit passed value. |
void |
setAddress(IPv4Address second)
Sets the current address based upon the value of the passed object. |
void |
setAddress(java.lang.String ipv4Addr)
Sets the object by decomposing the passed string into it four components. |
java.lang.String |
toString()
Converts the object to a string and returns the string to the caller. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
private byte[] m_addr
Constructor Detail |
public IPv4Address()
public IPv4Address(IPv4Address second)
second
- The object to copy the address from.public IPv4Address(byte[] addr)
addr
- The IPv4Address data
java.lang.IllegalArgumentException
- Thrown if the passed buffer is not in the correct format
for an IPv4Address.public IPv4Address(int ipv4Addr)
ipv4Addr
- The 32-bit IP address.public IPv4Address(java.lang.String ipv4Addr)
ipv4Addr
- The dotted decimal address.
java.lang.IllegalArgumentException
- Thrown if the string is a malformed dotted decimal
address.public IPv4Address(java.net.InetAddress addr)
addr
- The Internet Address containing the IPv4 address.Method Detail |
private byte[] dup(byte[] src)
src
- The source bytes to duplicate.
private static int byteToInt(byte b)
b
- The byte to convert.
public static java.lang.String addressToString(int ipv4Addr)
ipv4Addr
- The 32-bit address
public static java.lang.String addressToString(byte[] buf)
buf
- The 4 byte buffer
java.lang.IllegalArgumentException
- Thrown if the buffer is not exactly 4 bytes in length.public int getAddress()
public byte[] getAddressBytes()
public void setAddress(IPv4Address second)
second
- The new address.public void setAddress(byte[] addr)
addr
- The IPv4Address data
java.lang.IllegalArgumentException
- Thrown if the passed buffer is not in the correct format
for an IPv4Address.public void setAddress(int ipv4Addr)
ipv4Addr
- The 32-bit IP address.public void setAddress(java.lang.String ipv4Addr)
ipv4Addr
- The dotted decimal address.
java.lang.IllegalArgumentException
- Thrown if the string is a malformed dotted decimal
address.public void setAddress(java.net.InetAddress addr)
addr
- The Internet Address containing the IPv4 address.public boolean equals(java.lang.Object obj)
obj
- The object to use in the comparison.
public java.lang.String toString()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |