snmp
Class SNMPObjectIdentifier

java.lang.Object
  |
  +--snmp.SNMPObject
        |
        +--snmp.SNMPObjectIdentifier

public class SNMPObjectIdentifier
extends SNMPObject

Class representing ASN.1 object identifiers. These are unbounded sequences (arrays) of natural numbers, written as dot-separated strings.


Constructor Summary
SNMPObjectIdentifier()
          Create a new empty object identifier (0-length array).
SNMPObjectIdentifier(byte[] enc)
          Used to initialize from the BER encoding, as received in a response from an SNMP device responding to an SNMPGetRequest.
SNMPObjectIdentifier(int[] digits)
          Create a new object identifier from the supplied array of nonegative integer values.
SNMPObjectIdentifier(java.lang.String digitString)
          Create a new object identifier from the supplied string of dot-separated nonegative decimal integer values.
 
Method Summary
 boolean equals(SNMPObjectIdentifier other)
          Test two obeject identifiers for equality.
 byte[] getBEREncoding()
          Return BER encoding for this object identifier.
 java.lang.Object getValue()
          Return array of integers corresponding to components of identifier.
 void setValue(java.lang.Object digits)
          Used to set the value from an integer array containing the identifier components, or from a String containing a dot-separated sequence of nonegative values.
 java.lang.String toString()
          Return dot-separated sequence of decimal values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SNMPObjectIdentifier

public SNMPObjectIdentifier()
Create a new empty object identifier (0-length array).

SNMPObjectIdentifier

public SNMPObjectIdentifier(java.lang.String digitString)
                     throws SNMPBadValueException
Create a new object identifier from the supplied string of dot-separated nonegative decimal integer values.
Throws:
SNMPBadValueException - Indicates incorrectly-formatted string supplied.

SNMPObjectIdentifier

public SNMPObjectIdentifier(int[] digits)
                     throws SNMPBadValueException
Create a new object identifier from the supplied array of nonegative integer values.
Throws:
SNMPBadValueException - Negative value(s) supplied.

SNMPObjectIdentifier

public SNMPObjectIdentifier(byte[] enc)
                     throws SNMPBadValueException
Used to initialize from the BER encoding, as received in a response from an SNMP device responding to an SNMPGetRequest.
Throws:
SNMPBadValueException - Indicates an invalid BER encoding supplied. Shouldn't occur in normal operation, i.e., when valid responses are received from devices.
Method Detail

getValue

public java.lang.Object getValue()
Return array of integers corresponding to components of identifier.
Overrides:
getValue in class SNMPObject

setValue

public void setValue(java.lang.Object digits)
              throws SNMPBadValueException
Used to set the value from an integer array containing the identifier components, or from a String containing a dot-separated sequence of nonegative values.
Overrides:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied, or negative array elements, or an incorrectly formatted String.

getBEREncoding

public byte[] getBEREncoding()
Return BER encoding for this object identifier.
Overrides:
getBEREncoding in class SNMPObject

equals

public boolean equals(SNMPObjectIdentifier other)
Test two obeject identifiers for equality.

toString

public java.lang.String toString()
Return dot-separated sequence of decimal values.
Overrides:
toString in class SNMPObject