HOME

com.ireasoning.protocol.snmp
Class SnmpCounter32

java.lang.Object
  |
  +--com.ireasoning.protocol.snmp.SnmpUInt
        |
        +--com.ireasoning.protocol.snmp.SnmpCounter32
All Implemented Interfaces:
Msg, Serializable, SnmpDataType

public class SnmpCounter32
extends SnmpUInt

The class represents snmp Counter32 type object. The Counter32 type represents a non-negative integer which monotonically increases until it reaches a maximum value of 2^32-1 (4294967295 decimal), when it wraps around and starts increasing again from zero.

See Also:
Serialized Form

Field Summary
static SnmpCounter32 MAX_VALUE
          A constant holding the maximum value a SnmpCounter32 can have
 
Fields inherited from interface com.ireasoning.protocol.snmp.SnmpDataType
BITS, BITSTRING, COUNTER32, COUNTER64, END_OF_MIB_VIEW, END_OF_MIB_VIEW_OBJECT, GAUGE32, INTEGER, IPADDRESS, NO_SUCH_INSTANCE, NO_SUCH_INSTANCE_OBJECT, NO_SUCH_OBJECT, NO_SUCH_OBJECT_OBJECT, NULL, OCTETSTRING, OID, OPAQUE, PDU, SEQUENCE, SEQUENCEOF, TIMETICKS, UNSIGNED32, VARBIND
 
Fields inherited from interface com.ireasoning.protocol.Msg
ERROR_TYPE
 
Constructor Summary
SnmpCounter32()
          Constructs a new SnmpCounter32 object
SnmpCounter32(long counter)
          Constructs a SnmpCounter32 object based on passed counter
SnmpCounter32(SnmpCounter32 counter32)
          Constructs a copy of passed-in SnmpCounter32 object.
SnmpCounter32(SnmpUInt uint32)
          Constructs a SnmpCounter32 object based on the passed-in SnmpUInt object.
SnmpCounter32(String counter)
          Constructs a SnmpCounter32 object based on passed counter
 
Method Summary
 SnmpDataType copy()
          Makes a copy of itself
 int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
          For internal use
 int getType()
          Returns SnmpDataType.COUNTER32
 String getTypeString()
          Returns "Counter32"
 void inc()
          Increments counter value by 1, wrap around if it reaches max.
 void inc(long val)
          Increments counter value by val, wrap around if it reaches max.
 void setValue(long value)
          Sets a new value
 String toString()
           
 
Methods inherited from class com.ireasoning.protocol.snmp.SnmpUInt
equals, getValue, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final SnmpCounter32 MAX_VALUE
A constant holding the maximum value a SnmpCounter32 can have
Constructor Detail

SnmpCounter32

public SnmpCounter32()
Constructs a new SnmpCounter32 object

SnmpCounter32

public SnmpCounter32(String counter)
Constructs a SnmpCounter32 object based on passed counter

SnmpCounter32

public SnmpCounter32(long counter)
Constructs a SnmpCounter32 object based on passed counter

SnmpCounter32

public SnmpCounter32(SnmpCounter32 counter32)
Constructs a copy of passed-in SnmpCounter32 object.
Parameters:
counter32 - an SnmpCounter32 object to be copied.

SnmpCounter32

public SnmpCounter32(SnmpUInt uint32)
Constructs a SnmpCounter32 object based on the passed-in SnmpUInt object.
Parameters:
uint32 - The SnmpUInt object to copy.
Method Detail

getType

public int getType()
Returns SnmpDataType.COUNTER32
Overrides:
getType in class SnmpUInt
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
the object data type

getTypeString

public String getTypeString()
Returns "Counter32"
Overrides:
getTypeString in class SnmpUInt

inc

public void inc(long val)
Increments counter value by val, wrap around if it reaches max.
Throws:
UnsupportedOperationException - if called for SnmpCounter32.MAX_VALUE

inc

public void inc()
Increments counter value by 1, wrap around if it reaches max.
Throws:
UnsupportedOperationException - if called for SnmpCounter32.MAX_VALUE

setValue

public void setValue(long value)
Sets a new value
Overrides:
setValue in class SnmpUInt
Throws:
UnsupportedOperationException - if called for SnmpCounter32.MAX_VALUE

toString

public String toString()
Overrides:
toString in class SnmpUInt

copy

public SnmpDataType copy()
Description copied from interface: SnmpDataType
Makes a copy of itself
Overrides:
copy in class SnmpUInt
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
a deep copy of this object

encode

public int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
           throws SnmpEncodingException
Description copied from interface: SnmpDataType
For internal use
Overrides:
encode in class SnmpUInt

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.