JoeSNMP API 0.2.6

org.opennms.protocols.snmp
Class SnmpIPAddress

java.lang.Object
  extended byorg.opennms.protocols.snmp.SnmpOctetString
      extended byorg.opennms.protocols.snmp.SnmpIPAddress
All Implemented Interfaces:
Cloneable, Serializable, SnmpSyntax

public class SnmpIPAddress
extends SnmpOctetString

This SnmpIPAddress is used to extend the Snmp Octet String SMI class. This is normally used to transmit IP Addresses with a length of 4 bytes. Most of the management of the data is handled by the base class.

Version:
$Revision: 1.4 $
Author:
Serialized Form

Field Summary
static byte ASNTYPE
          Defines the ASN.1 type for this object.
(package private) static long serialVersionUID
          Required for evolving serialization format.
 
Fields inherited from class org.opennms.protocols.snmp.SnmpOctetString
 
Constructor Summary
SnmpIPAddress()
          Constructs a default object with a length of zero.
SnmpIPAddress(byte[] data)
          Constructs an Application String with the passed data.
SnmpIPAddress(SnmpIPAddress second)
          Copy constructor.
SnmpIPAddress(SnmpOctetString second)
          Copy constructor based on the base class.
 
Method Summary
 Object clone()
          Create a new object that is a duplicate of the current object.
 IPv4Address convertToIpAddress()
          Converts the current Application String to an IPv4Address object.
 SnmpSyntax duplicate()
          Create a new object that is a duplicate of the current object.
 String toString()
          Returns the application string as a IPv4 dotted decimal address
 byte typeId()
          Returns the ASN.1 type for this object.
 
Methods inherited from class org.opennms.protocols.snmp.SnmpOctetString
decodeASN, encodeASN, getLength, getString, setString, setString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
Required for evolving serialization format.

See Also:
Constant Field Values

ASNTYPE

public static final byte ASNTYPE
Defines the ASN.1 type for this object.

See Also:
Constant Field Values
Constructor Detail

SnmpIPAddress

public SnmpIPAddress()
Constructs a default object with a length of zero. See the super class constructor for more details.


SnmpIPAddress

public SnmpIPAddress(byte[] data)
Constructs an Application String with the passed data. The data is managed by the base class.

Parameters:
data - The application string to manage (UTF-8)

SnmpIPAddress

public SnmpIPAddress(SnmpIPAddress second)
Copy constructor. Constructs a duplicate object based on the passed application string object.

Parameters:
second - The object to copy.

SnmpIPAddress

public SnmpIPAddress(SnmpOctetString second)
Copy constructor based on the base class.

Parameters:
second - The object to copy
Method Detail

typeId

public byte typeId()
Returns the ASN.1 type for this object.

Specified by:
typeId in interface SnmpSyntax
Overrides:
typeId in class SnmpOctetString
Returns:
The ASN.1 value for this object.

duplicate

public SnmpSyntax duplicate()
Create a new object that is a duplicate of the current object.

Specified by:
duplicate in interface SnmpSyntax
Overrides:
duplicate in class SnmpOctetString
Returns:
A newly created duplicate object.

clone

public Object clone()
Create a new object that is a duplicate of the current object.

Overrides:
clone in class SnmpOctetString
Returns:
A newly created duplicate object.

convertToIpAddress

public IPv4Address convertToIpAddress()
                               throws SnmpBadConversionException
Converts the current Application String to an IPv4Address object. If the length is not four bytes in length or an error occurs during the conversion then an exception is thrown.

Returns:
The IPv4Address converted from the appliation string
Throws:
SnmpBadConversionException - Thrown if the length of the string is invalid. Must be equal to four

toString

public String toString()
Returns the application string as a IPv4 dotted decimal address

Overrides:
toString in class SnmpOctetString

JoeSNMP API 0.2.6

Generated by jpp on July 15 2004 1044.