Package org.opennms.protocols.snmp
Class SnmpCounter64
- java.lang.Object
-
- org.opennms.protocols.snmp.SnmpCounter64
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,SnmpSyntax
public class SnmpCounter64 extends java.lang.Object implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
This class defines the 64-bit SNMP counter object used to transmit 64-bit unsigned number.- Author:
- Brian Weaver
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static byte
ASNTYPE
The ASN.1 value for an unsigned integer value.
-
Constructor Summary
Constructors Constructor Description SnmpCounter64()
Default class constructor.SnmpCounter64(long value)
Constructs a SnmpCounter64 object with the specified value.SnmpCounter64(java.lang.String value)
Simple class constructor that is used to create an initialize the new instance with the unsigned value decoded from the passed String argument.SnmpCounter64(java.math.BigInteger value)
Constructs a SnmpCounter64 object with the specified value.SnmpCounter64(SnmpCounter64 second)
Class copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Returns a duplicte of the current objectint
decodeASN(byte[] buf, int offset, AsnEncoder encoder)
Used to decode the integer value from the ASN.1 buffer.SnmpSyntax
duplicate()
Returns a duplicte of the current objectint
encodeASN(byte[] buf, int offset, AsnEncoder encoder)
Used to encode the integer value into an ASN.1 buffer.java.math.BigInteger
getValue()
Used to retreive the 64-bit unsigned value.void
setValue(java.math.BigInteger value)
Used to set the 64-bit unsigned quantity.java.lang.String
toString()
Returns the string representation of the object.byte
typeId()
Used to retreive the ASN.1 type for this object.
-
-
-
Field Detail
-
ASNTYPE
public static final byte ASNTYPE
The ASN.1 value for an unsigned integer value. BEWARE this value will conflict with the SnmpSMI.SMI_COUNTER32 value. This object should not be dynamically registered with the SNMP library- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnmpCounter64
public SnmpCounter64()
Default class constructor. Constructs the object with a value of zero(0).
-
SnmpCounter64
public SnmpCounter64(long value)
Constructs a SnmpCounter64 object with the specified value.- Parameters:
value
- The new 64-bit value.
-
SnmpCounter64
public SnmpCounter64(java.math.BigInteger value)
Constructs a SnmpCounter64 object with the specified value.- Parameters:
value
- The new 64-bit value.
-
SnmpCounter64
public SnmpCounter64(SnmpCounter64 second)
Class copy constructor. Constructs a new object with the same value as the passed object.- Parameters:
second
- The object to copy the value from.
-
SnmpCounter64
public SnmpCounter64(java.lang.String value)
Simple class constructor that is used to create an initialize the new instance with the unsigned value decoded from the passed String argument. If the decoded argument is malformed, null, or evaluates to a negative value then an exception is generated.
- Parameters:
value
- The string encoded value.- Throws:
java.lang.NumberFormatException
- Thrown if the passed value is malformed and cannot be parsed.java.lang.IllegalArgumentException
- Throws if the passed value evaluates to a negative value.java.lang.NullPointerException
- Throws if the passed value is a null reference.
-
-
Method Detail
-
getValue
public java.math.BigInteger getValue()
Used to retreive the 64-bit unsigned value.- Returns:
- The internal 64-bit value.
-
setValue
public void setValue(java.math.BigInteger value)
Used to set the 64-bit unsigned quantity. If the value exceeds 64-bit then the upper 64-bits will be silently truncated from the value.- Parameters:
value
- The new value for the object
-
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 SnmpCounter64
-
encodeASN
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
Used to encode the integer 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 integer value from the ASN.1 buffer. The passed encoder is used to decode the ASN.1 information and the integer value is stored in the internal object.- 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()
Returns a duplicte of the current object- Specified by:
duplicate
in interfaceSnmpSyntax
- Returns:
- A duplciate copy of the current object
-
clone
public java.lang.Object clone()
Returns a duplicte of the current object- Overrides:
clone
in classjava.lang.Object
- Returns:
- A duplciate copy of the current object
-
toString
public java.lang.String toString()
Returns the string representation of the object.- Overrides:
toString
in classjava.lang.Object
-
-