com.adventnet.snmp.snmp2
Class SnmpCounter
java.lang.Object
|
+--com.adventnet.snmp.snmp2.SnmpVar
|
+--com.adventnet.snmp.snmp2.SnmpUnsignedInt
|
+--com.adventnet.snmp.snmp2.SnmpCounter
- public class SnmpCounter
- extends SnmpUnsignedInt
Class of SNMP Counter Variable - Sub-class of SnmpUnsignedInt.
- See Also:
- Serialized Form
|
Constructor Summary |
SnmpCounter(long s)
Constructor requires a long as its argument. |
|
Method Summary |
(package private) int |
encode(byte[] buff,
int space)
ASN encoder |
long |
getIncrement(long lastValue)
Gets the (positive) increment of this Counter variable over a long. |
long |
getIncrement(SnmpCounter c)
Gets the (positive) increment of this Counter variable over another. |
java.lang.String |
toTagString()
To convert the object to a printable string tagged with Counter: |
| Methods inherited from class java.lang.Object |
,
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
SnmpCounter
public SnmpCounter(long s)
- Constructor requires a long as its argument.
- Parameters:
s - long value
The valid values ranges from 0 to 4294967295(both inclusive).
toTagString
public java.lang.String toTagString()
- To convert the object to a printable string tagged with Counter:
- Overrides:
- toTagString in class SnmpUnsignedInt
- Returns:
- string tagged with Counter:
getIncrement
public long getIncrement(SnmpCounter c)
- Gets the (positive) increment of this Counter variable over another.
Takes care of wraparound by adding the MAX counter value if negative.
getIncrement
public long getIncrement(long lastValue)
- Gets the (positive) increment of this Counter variable over a long.
Takes care of wraparound by adding the MAX counter value if negative.
encode
int encode(byte[] buff,
int space)
throws java.lang.ArrayIndexOutOfBoundsException
- ASN encoder
- Overrides:
- encode in class SnmpUnsignedInt
- 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:
- java.lang.ArrayIndexOutOfBoundsException - When there is insufficient space in buffer