HOME

com.ireasoning.protocol.snmp
Class SnmpCounter32

java.lang.Object
  extended bycom.ireasoning.protocol.snmp.SnmpUInt
      extended bycom.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 an 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, serialVersionUID, 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 an SnmpCounter32 object based on passed counter
SnmpCounter32(SnmpCounter32 counter32)
          Constructs a copy of passed-in SnmpCounter32 object.
SnmpCounter32(SnmpUInt uint32)
          Constructs an SnmpCounter32 object based on the passed-in SnmpUInt object.
SnmpCounter32(String counter)
          Constructs an 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 an SnmpCounter32 can have

Constructor Detail

SnmpCounter32

public SnmpCounter32()
Constructs a new SnmpCounter32 object


SnmpCounter32

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


SnmpCounter32

public SnmpCounter32(long counter)
Constructs an 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 an 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

Specified by:
getType in interface SnmpDataType
Overrides:
getType in class SnmpUInt

getTypeString

public String getTypeString()
Returns "Counter32"

Specified by:
getTypeString in interface SnmpDataType
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

Specified by:
copy in interface SnmpDataType
Overrides:
copy in class SnmpUInt

encode

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

Specified by:
encode in interface SnmpDataType
Overrides:
encode in class SnmpUInt
Throws:
SnmpEncodingException

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.