snmp
Class SNMPInteger

java.lang.Object
  |
  +--snmp.SNMPObject
        |
        +--snmp.SNMPInteger
Direct Known Subclasses:
SNMPCounter32, SNMPCounter64, SNMPGauge32, SNMPTimeTicks, SNMPUInteger32

public class SNMPInteger
extends SNMPObject

Defines an arbitrarily-sized integer value; there is no limit on size due to the use of Java.lang.BigInteger to store the value internally. For an indicator which "pegs" at its maximum value if initialized with a larger value, use SNMPGauge32; for a counter which wraps, use SNMPCounter32 or SNMPCounter64.

See Also:
SNMPCounter32, SNMPGauge32, SNMPCounter64

Field Summary
protected  byte tag
           
protected  java.math.BigInteger value
           
 
Constructor Summary
SNMPInteger()
          Initialize value to 0.
SNMPInteger(byte[] enc)
          Used to initialize from the BER encoding, usually received in a response from an SNMP device responding to an SNMPGetRequest.
SNMPInteger(long value)
           
 
Method Summary
 void extractValueFromBEREncoding(byte[] enc)
          Used to extract a value from the BER encoding of the value.
 byte[] getBEREncoding()
          Returns the full BER encoding (type, length, value) of the SNMPInteger subclass.
 java.lang.Object getValue()
          Returns a java.lang.BigInteger object with the current value.
 void setValue(java.lang.Object newValue)
          Used to set the value with an instance of java.lang.Integer or java.lang.BigInteger.
 java.lang.String toString()
          Should return an appropriate human-readable representation of the stored value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected java.math.BigInteger value

tag

protected byte tag
Constructor Detail

SNMPInteger

public SNMPInteger()
Initialize value to 0.

SNMPInteger

public SNMPInteger(long value)

SNMPInteger

public SNMPInteger(byte[] enc)
            throws SNMPBadValueException
Used to initialize from the BER encoding, usually received in a response from an SNMP device responding to an SNMPGetRequest.
Throws:
SNMPBadValueException - Indicates an invalid BER encoding supplied. Shouldn't occur in normal operation, i.e., when valid responses are received from devices.
Method Detail

getValue

public java.lang.Object getValue()
Returns a java.lang.BigInteger object with the current value.
Overrides:
getValue in class SNMPObject

setValue

public void setValue(java.lang.Object newValue)
              throws SNMPBadValueException
Used to set the value with an instance of java.lang.Integer or java.lang.BigInteger.
Overrides:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied.

getBEREncoding

public byte[] getBEREncoding()
Returns the full BER encoding (type, length, value) of the SNMPInteger subclass.
Overrides:
getBEREncoding in class SNMPObject

extractValueFromBEREncoding

public void extractValueFromBEREncoding(byte[] enc)
                                 throws SNMPBadValueException
Used to extract a value from the BER encoding of the value. Called in constructors for SNMPInteger subclasses.
Throws:
SNMPBadValueException - Indicates an invalid BER encoding supplied. Shouldn't occur in normal operation, i.e., when valid responses are received from devices.

toString

public java.lang.String toString()
Description copied from class: SNMPObject
Should return an appropriate human-readable representation of the stored value.
Overrides:
toString in class SNMPObject