com.adventnet.snmp.snmp2
Class SnmpInt

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SnmpVar
        |
        +--com.adventnet.snmp.snmp2.SnmpInt

public class SnmpInt
extends SnmpVar

Class of SNMP Integer Variable - Sub-class of SnmpVar This class can be used to created a SnmpVar object of type SnmpInt. It also has methods to retrieve the value in different forms(eg. interger String, byte).

See Also:
Serialized Form

Field Summary
(package private)  byte[] byteValue
           
(package private)  long value
           
 
Fields inherited from class com.adventnet.snmp.snmp2.SnmpVar
Type, varbindErrorVal
 
Constructor Summary
SnmpInt(int value)
          Constructs a new SnmpInt object by taking an integer value as argument.
SnmpInt(long value)
          Constructs a new SnmpInt object by taking long value as argument.
 
Method Summary
(package private)  int encode(byte[] buff, int space)
          ASN encoder
 boolean equals(java.lang.Object obj)
          This method returns true if both the SnmpInt objects are equal and false otherwise.
 java.lang.String getNumericValueAsString()
          This method returns the numeric value of the INTEGER data type in decimal ( base 10 ) format.
 java.lang.Object getVarObject()
          Returns the value of this SnmpInt object as an Integer object.
 int intValue()
          Returns the value of this SnmpInt object as an integer.
 long longValue()
          Returns the value of this SnmpInt object as long.
 byte[] toBytes()
          To return the value of this SnmpInt object as raw bytes.
 java.lang.String toString()
          To convert the value of this SnmpInt object to a printable string.
 java.lang.String toTagString()
          To convert the value of this SnmpInt object to a printable string, where the type is tagged before the value with a tag INTEGER: .
 java.lang.Object toValue()
          Returns the value of this SnmpInt object as an Integer object.
 
Methods inherited from class com.adventnet.snmp.snmp2.SnmpVar
createVariable, getError, getType, getTypeString
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

long value

byteValue

byte[] byteValue
Constructor Detail

SnmpInt

public SnmpInt(int value)
Constructs a new SnmpInt object by taking an integer value as argument.
Parameters:
value - Integer value for creating a new SnmpInt object.

SnmpInt

public SnmpInt(long value)
Constructs a new SnmpInt object by taking long value as argument.
Parameters:
value - long value for creating a new SnmpInt object.
Method Detail

getVarObject

public java.lang.Object getVarObject()
Returns the value of this SnmpInt object as an Integer object. This method is the same as toValue()
Overrides:
getVarObject in class SnmpVar
Returns:
Integer object

equals

public boolean equals(java.lang.Object obj)
This method returns true if both the SnmpInt objects are equal and false otherwise.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the SnmpInt object whose equality is to be checked.
Returns:
true, if both are equal and false otherwise.

toValue

public java.lang.Object toValue()
Returns the value of this SnmpInt object as an Integer object.
Overrides:
toValue in class SnmpVar
Returns:
the value of this SnmpInt object as an Integer object.

intValue

public int intValue()
Returns the value of this SnmpInt object as an integer.
Returns:
the value of this SnmpInt object as an integer.

longValue

public long longValue()
Returns the value of this SnmpInt object as long.
Returns:
the value of this SnmpInt object as long.

toString

public java.lang.String toString()
To convert the value of this SnmpInt object to a printable string.
Overrides:
toString in class SnmpVar
Returns:
the value of this SnmpInt object as a string value.

toTagString

public java.lang.String toTagString()
To convert the value of this SnmpInt object to a printable string, where the type is tagged before the value with a tag INTEGER: . For e.g if the SnmpInt has the value 5, then this method will return - INTEGER: 5.
Overrides:
toTagString in class SnmpVar
Returns:
the value of this SnmpInt object to a printable string where the type is tagged before the value with a tag INTEGER: .

toBytes

public byte[] toBytes()
To return the value of this SnmpInt object as raw bytes.
Overrides:
toBytes in class SnmpVar
Returns:
the value of this SnmpInt object as raw bytes.

getNumericValueAsString

public java.lang.String getNumericValueAsString()
This method returns the numeric value of the INTEGER data type in decimal ( base 10 ) format.
Overrides:
getNumericValueAsString in class SnmpVar
Returns:
The numeric value of the INTEGER type in decimal format.

encode

int encode(byte[] buff,
           int space)
     throws java.lang.ArrayIndexOutOfBoundsException
ASN encoder
Overrides:
encode in class SnmpVar
Parameters:
buff - The buffer into which the value is to be encoded
space - The number of free bytes in the buffer
Returns:
The number of free bytes in the buffer
Throws:
java.lang.ArrayIndexOutOfBoundsException - When there is insufficient space in buffer