com.adventnet.snmp.snmp2
Class SnmpUnsignedInt
java.lang.Object
|
+--com.adventnet.snmp.snmp2.SnmpVar
|
+--com.adventnet.snmp.snmp2.SnmpUnsignedInt
- Direct Known Subclasses:
- SnmpCounter, SnmpGauge, SnmpTimeticks
- public class SnmpUnsignedInt
- extends SnmpVar
Class of SNMP Unsigned Integer Variable.
This class can be used to created an SnmpVar object of type
SnmpUnsignedInt.
It also has methods to retrieve the value in different forms(eg. long
String, byte).
- See Also:
- Serialized Form
|
Field Summary |
(package private) byte[] |
byteValue
|
(package private) long |
value
|
|
Constructor Summary |
SnmpUnsignedInt(long val)
Constructs a new SnmpUnsignedInt by taking a long type as its argument. |
|
Method Summary |
(package private) int |
encode(byte[] buff,
int space)
ASN encoder |
boolean |
equals(java.lang.Object obj)
Returns true, if both the SnmpUnsignedInt objects have the same value and
false otherwise. |
java.lang.String |
getNumericValueAsString()
This method returns the numeric value of the UNSIGNED32 data type in
decimal ( base 10 ) format. |
java.lang.Object |
getVarObject()
Returns the value of this SnmpUnsignedInt as a Long object. |
long |
longValue()
Returns the value of this SnmpUnsignedInt as a long value. |
byte[] |
toBytes()
Returns the value of this SnmpUnsignedInt as raw bytes. |
java.lang.String |
toString()
To convert the value of this SnmpUnsignedInt to a printable string
used in printing variables. |
java.lang.String |
toTagString()
To convert the value of this SnmpUnsignedInt object to a printable
string where the type is tagged before the value with a tag UNSIGNED: . |
java.lang.Object |
toValue()
Returns the value of this SnmpUnsignedInt as a Long object. |
| Methods inherited from class java.lang.Object |
,
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
value
long value
byteValue
byte[] byteValue
SnmpUnsignedInt
public SnmpUnsignedInt(long val)
- Constructs a new SnmpUnsignedInt by taking a long type as its argument.
- Parameters:
val - the long type for creating a new SnmpUnsignedInt object.
The valid values ranges from 0 to 4294967295(both inclusive).the - unsigned integer value. If this value is given lesser than
zero, then it will be taken as zero and if it is given greater than
the maximun, then the maximum value will be taken.
getVarObject
public java.lang.Object getVarObject()
- Returns the value of this SnmpUnsignedInt as a Long object.
This method is the same as toValue().
- Overrides:
- getVarObject in class SnmpVar
- Returns:
- the value of this SnmpUnsignedInt as a Long Object Value.
toValue
public java.lang.Object toValue()
- Returns the value of this SnmpUnsignedInt as a Long object.
- Overrides:
- toValue in class SnmpVar
- Returns:
- the value of this SnmpUnsignedInt as a Long Object Value.
longValue
public long longValue()
- Returns the value of this SnmpUnsignedInt as a long value.
- Returns:
- the value of this SnmpUnsignedInt as a long value.
toString
public java.lang.String toString()
- To convert the value of this SnmpUnsignedInt to a printable string
used in printing variables.
- Overrides:
- toString in class SnmpVar
- Returns:
- the value of this SnmpUnsignedInt as a string Object Value.
toTagString
public java.lang.String toTagString()
- To convert the value of this SnmpUnsignedInt object to a printable
string where the type is tagged before the value with a tag UNSIGNED: .
For e.g if the SnmpUnsignedInt has a value of 1234567, then this method
will return - UNSIGNED: 1234567 .
- Overrides:
- toTagString in class SnmpVar
- Returns:
- the value of this SnmpUnsignedInt object to a printable
string where the type is tagged before the value with a tag UNSIGNED: .
toBytes
public byte[] toBytes()
- Returns the value of this SnmpUnsignedInt as raw bytes.
- Overrides:
- toBytes in class SnmpVar
- Returns:
- the value of this SnmpUnsignedInt as raw bytes.
getNumericValueAsString
public java.lang.String getNumericValueAsString()
- This method returns the numeric value of the UNSIGNED32 data type in
decimal ( base 10 ) format.
- Overrides:
- getNumericValueAsString in class SnmpVar
- Returns:
- The numeric value of the UNSIGNED32 type in decimal format.
equals
public boolean equals(java.lang.Object obj)
- Returns true, if both the SnmpUnsignedInt objects have the same value and
false otherwise.
- Overrides:
- equals in class java.lang.Object
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 encodedspace - The number of free bytes in the buffer- Returns:
- The number of free bytes in the buffer
- Throws:
- throws - ArrayIndexOutOfBoundsException