Package org.opennms.protocols.snmp
Class SnmpNull
- java.lang.Object
-
- org.opennms.protocols.snmp.SnmpNull
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,SnmpSyntax
public class SnmpNull extends java.lang.Object implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
Implements the SNMP Null object as defined by the SNMPv1 and SNMPv2 SMI. The object has no data or length, but is encoded with a specific header. Often used as the value portion of an SnmpVarBind when sending a GET, GETNEXT, etc to a remote agent. This class manages no internal data, but is derived to provide the proper encoding and handling of SNMP Null datatypes.- Author:
- Brian Weaver
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static byte
ASNTYPE
Defines the ASN.1 value for the SnmpNull class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Used to get a duplicate of the current object so that it can be modified without affecting the creating object.int
decodeASN(byte[] buf, int offset, AsnEncoder encoder)
Used to decode the null value from the ASN.1 buffer.SnmpSyntax
duplicate()
Used to get a duplicate of the current object so that it can be modified without affecting the creating object.int
encodeASN(byte[] buf, int offset, AsnEncoder encoder)
Used to encode the null value into an ASN.1 buffer.java.lang.String
toString()
Returns a string representation of the SNMP Null objectbyte
typeId()
Used to retreive the ASN.1 type for this object.
-
-
-
Field Detail
-
ASNTYPE
public static final byte ASNTYPE
Defines the ASN.1 value for the SnmpNull class.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnmpNull
public SnmpNull()
Constructs a default SnmpNull class
-
SnmpNull
public SnmpNull(SnmpNull second)
Copy constructor. Provided so that if the class is extended or should at some point manage internal data, the data could be meaningfully copied from the passed object.- Parameters:
second
- The class object to set data from.
-
-
Method Detail
-
typeId
public byte typeId()
Used to retreive the ASN.1 type for this object.- Specified by:
typeId
in interfaceSnmpSyntax
- Returns:
- The ASN.1 value for the SnmpNull
-
encodeASN
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
Used to encode the null value into an ASN.1 buffer. The passed encoder defines the method for encoding the data.- Specified by:
encodeASN
in interfaceSnmpSyntax
- Parameters:
buf
- The location to write the encoded dataoffset
- The start of the encoded buffer.encoder
- The ASN.1 encoder object- Returns:
- The byte immediantly after the last encoded byte.
- Throws:
AsnEncodingException
- Thrown if an encoding error occurs
-
decodeASN
public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
Used to decode the null value from the ASN.1 buffer. The passed encoder is used to decode the ASN.1 information.- Specified by:
decodeASN
in interfaceSnmpSyntax
- Parameters:
buf
- The encoded ASN.1 dataoffset
- The offset of the first byte of dataencoder
- The ASN.1 decoder object.- Returns:
- The byte immediantly after the last decoded byte of information.
- Throws:
AsnDecodingException
- Thrown if an encoding error occurs
-
duplicate
public SnmpSyntax duplicate()
Used to get a duplicate of the current object so that it can be modified without affecting the creating object.- Specified by:
duplicate
in interfaceSnmpSyntax
- Returns:
- A duplicate of the current object.
-
clone
public java.lang.Object clone()
Used to get a duplicate of the current object so that it can be modified without affecting the creating object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- A duplicate of the current object.
-
toString
public java.lang.String toString()
Returns a string representation of the SNMP Null object- Overrides:
toString
in classjava.lang.Object
-
-