snmp
Class SNMPObjectIdentifier

java.lang.Object
  extended bysnmp.SNMPObject
      extended bysnmp.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.


Field Summary
protected  byte tag
           
 
Constructor Summary
  SNMPObjectIdentifier()
          Create a new empty object identifier (0-length array).
protected 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(long[] digits)
          Create a new object identifier from the supplied array of nonegative long 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(java.lang.Object other)
          Checks the internal arrays for equality.
protected  byte[] getBEREncoding()
          Return BER encoding for this object identifier.
 java.lang.Object getValue()
          Return array of integers corresponding to components of identifier.
 int hashCode()
          Generates a hash value so SNMP Object Identifiers can be used in Hashtables.
 void setValue(java.lang.Object digits)
          Used to set the value from an integer or long 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, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tag

protected byte tag
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(long[] digits)
                     throws SNMPBadValueException
Create a new object identifier from the supplied array of nonegative long values.

Throws:
SNMPBadValueException - Negative value(s) supplied.

SNMPObjectIdentifier

protected 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.

Specified by:
getValue in class SNMPObject

setValue

public void setValue(java.lang.Object digits)
              throws SNMPBadValueException
Used to set the value from an integer or long array containing the identifier components, or from a String containing a dot-separated sequence of nonegative values.

Specified by:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied, or negative array elements, or an incorrectly formatted String.

getBEREncoding

protected byte[] getBEREncoding()
Return BER encoding for this object identifier.

Specified by:
getBEREncoding in class SNMPObject

equals

public boolean equals(java.lang.Object other)
Checks the internal arrays for equality.

Overrides:
equals in class SNMPObject

hashCode

public int hashCode()
Generates a hash value so SNMP Object Identifiers can be used in Hashtables.

Overrides:
hashCode in class SNMPObject

toString

public java.lang.String toString()
Return dot-separated sequence of decimal values.

Specified by:
toString in class SNMPObject