OpenNMS API 1.2.9

## org.opennms.protocols.snmp
Class SnmpUInt32

    java.lang.Object
      org.opennms.protocols.snmp.SnmpUInt32

All Implemented Interfaces:
  java.lang.Cloneable, java.io.Serializable, SnmpSyntax

Direct Known Subclasses:
  SnmpCounter32, SnmpGauge32, SnmpTimeTicks, SnmpV2PartyClock

public class SnmpUInt32
extends java.lang.Object
implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable

This class defines the 32-bit unsigned SNMP object used to transmit 32-bit unsigned number. The unsigned value is represented by a 64-bit quantity, but the upper 32-bits are always truncated from the value. If a caller passes in a value with any the upper 32-bits set the value will be silently truncated to a 32-bit value. If negative quantities or values with more than 32-bits are passed then data corruption will occur.

Author:
  OpenNMS , Brian Weaver
See Also:
  Serialized Form

Field Summary
`static byte` `ASNTYPE` The ASN.1 value for an unsigned integer value.
`private long` `m_value` The internal 32-bit unsigned quantity implemented as a 64-bit signed quantity
`private static long` `MASK` The 32-bit mask to be BITWISE AND with all values to ensure that only the lower 32-bits are set.
`(package private) static long` `serialVersionUID` defines the serialization version

Constructor Summary
`SnmpUInt32()` Default class constructor.
`SnmpUInt32(long value)` Constructs a SnmpUInt32 object with the specified value.
`SnmpUInt32(java.lang.Long value)` Constructs a SnmpUInt32 object with the specified value.
`SnmpUInt32(SnmpUInt32 second)` Class copy constructor.
`SnmpUInt32(java.lang.String value)` Simple class constructor that recovers the unsigned value from the passed string.

Method Summary
`java.lang.Object` `clone()` Returns a duplicte of the current object
`int` `decodeASN(byte[] buf, int offset, AsnEncoder encoder)` Used to decode the integer value from the ASN.1 buffer.
`SnmpSyntax` `duplicate()` Returns a duplicte of the current object
`int` `encodeASN(byte[] buf, int offset, AsnEncoder encoder)` Used to encode the integer value into an ASN.1 buffer.
`long` `getValue()` Used to retreive the 32-bit unsigned value.
`void` `setValue(long value)` Used to set the 32-bit unsigned quantity.
`void` `setValue(java.lang.Long value)` Used to set the 32-bit unsigned quantity.
`java.lang.String` `toString()` Returns the string representation of the object.
`byte` `typeId()` Used to retreive the ASN.1 type for this object.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### serialVersionUID

    static final long serialVersionUID

  defines the serialization version

  See Also:
    Constant Field Values

### m_value

    private long m_value

  The internal 32-bit unsigned quantity implemented as a 64-bit signed quantity

### MASK

    private static final long MASK

  The 32-bit mask to be BITWISE AND with all values to ensure that only the lower 32-bits are set.

  See Also:
    Constant Field Values

### ASNTYPE

    public static final byte ASNTYPE

  The ASN.1 value for an unsigned integer value. BEWARE this value will conflict with the SnmpSMI.SMI_COUNTER32 value. This object should not be dynamically registered with the SNMP library

  See Also:
    Constant Field Values

Constructor Detail

### SnmpUInt32

    public SnmpUInt32()

  Default class constructor. Constructs the object with a value of zero(0).

### SnmpUInt32

    public SnmpUInt32(long value)

  Constructs a SnmpUInt32 object with the specified value.

Parameters:
  `value` - The new 32-bit value.

### SnmpUInt32

    public SnmpUInt32(java.lang.Long value)

  Constructs a SnmpUInt32 object with the specified value.

Parameters:
  `value` - The new 32-bit value.

### SnmpUInt32

    public SnmpUInt32(SnmpUInt32 second)

  Class copy constructor. Constructs a new object with the same value as the passed object.

Parameters:
  `second` - The object to copy the value from.

### SnmpUInt32

    public SnmpUInt32(java.lang.String value)

  Simple class constructor that recovers the unsigned value from the passed string. If the decoded value evaluates to a negative number or is malformed then an exception is generated. Likewise, the argument must not be a null reference or a null pointer exception is generated by the constructor.

Parameters:
  `value` - The unsigned value encoded as a string.
Throws:
  `java.lang.NullPointerException` - Thrown if the passed value is a null pointer.
  `java.lang.IllegalArgumentException` - Thrown if the decoded value evaluates to a negative value.
  `java.lang.NumberFormatException` - Throws in the passed value cannot be decoded by the constructor.

Method Detail

### getValue

    public long getValue()

  Used to retreive the 32-bit unsigned value.

  Returns:
    The internal 32-bit value.

### setValue

    public void setValue(long value)

  Used to set the 32-bit unsigned quantity. If the value exceeds 32-bit then the upper 32-bits will be silently truncated from the value.

  Parameters:
    `value` - The new value for the object

### setValue

    public void setValue(java.lang.Long value)

  Used to set the 32-bit unsigned quantity. If the value exceeds 32-bit then the upper 32-bits will be silently truncated from the value.

  Parameters:
    `value` - The new value for the object

### typeId

    public byte typeId()

  Used to retreive the ASN.1 type for this object.

  Specified by:
    `typeId` in interface `SnmpSyntax`
  Returns:
    The ASN.1 value for the SnmpUInt32

### encodeASN

    public int encodeASN(byte[] buf,
                         int offset,
                         AsnEncoder encoder)
                  throws AsnEncodingException

  Used to encode the integer value into an ASN.1 buffer. The passed encoder defines the method for encoding the data.

  Specified by:
    `encodeASN` in interface `SnmpSyntax`
  Parameters:
    `buf` - The location to write the encoded data
    `offset` - The start of the encoded buffer.
    `encoder` - The ASN.1 encoder object
  Returns:
    The byte immediantly after the last encoded byte.
  Throws:
    `AsnEncodingException` - Thrown if an encoding error occurs

### decodeASN

    public int decodeASN(byte[] buf,
                         int offset,
                         AsnEncoder encoder)
                  throws AsnDecodingException

  Used to decode the integer value from the ASN.1 buffer. The passed encoder is used to decode the ASN.1 information and the integer value is stored in the internal object.

  Specified by:
    `decodeASN` in interface `SnmpSyntax`
  Parameters:
    `buf` - The encoded ASN.1 data
    `offset` - The offset of the first byte of data
    `encoder` - The ASN.1 decoder object.
  Returns:
    The byte immediantly after the last decoded byte of information.
  Throws:
    `AsnDecodingException` - Thrown if an encoding error occurs

### duplicate

    public SnmpSyntax duplicate()

  Returns a duplicte of the current object

  Specified by:
    `duplicate` in interface `SnmpSyntax`
  Returns:
    A duplciate copy of the current object

### clone

    public java.lang.Object clone()

  Returns a duplicte of the current object

  Returns:
    A duplciate copy of the current object

### toString

    public java.lang.String toString()

  Returns the string representation of the object.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.