snmp
Class SNMPInteger

java.lang.Object
  extended bysnmp.SNMPObject
      extended bysnmp.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(java.math.BigInteger value)
           
protected 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.
protected  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.
 java.lang.String toString(int radix)
           
 
Methods inherited from class snmp.SNMPObject
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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(java.math.BigInteger value)

SNMPInteger

protected 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.

Specified by:
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.

Specified by:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied.

getBEREncoding

protected byte[] getBEREncoding()
Returns the full BER encoding (type, length, value) of the SNMPInteger subclass.

Specified by:
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.

Specified by:
toString in class SNMPObject

toString

public java.lang.String toString(int radix)