com.amx.duet.tools.net.snmp.api
Class SNMPOctetString

java.lang.Object
  extended bycom.amx.duet.tools.net.snmp.api.SNMPObject
      extended bycom.amx.duet.tools.net.snmp.api.SNMPOctetString
Direct Known Subclasses:
SNMPBitString, SNMPIPAddress, SNMPNSAPAddress

public class SNMPOctetString
extends SNMPObject

Class representing a general string of octets.


Constructor Summary
SNMPOctetString()
          Create a zero-length octet string.
SNMPOctetString(byte[] enc)
          Create an octet string from the supplied byte array.
SNMPOctetString(java.lang.String stringData)
          Create an octet string from the bytes of the supplied String.
 
Method Summary
 boolean equals(java.lang.Object other)
          Checks the embedded arrays for equality.
 java.lang.Object getValue()
          Return the array of raw bytes.
 int hashCode()
          Generates a hash value so SNMP Octet String subclasses can be used in Hashtables.
 void setValue(java.lang.Object data)
          Used to set the value from a byte array.
 java.lang.String toHexString()
          Returns a space-separated hex string corresponding to the raw bytes.
 java.lang.String toString()
          Returns a String constructed from the raw bytes.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SNMPOctetString

public SNMPOctetString()
Create a zero-length octet string.


SNMPOctetString

public SNMPOctetString(java.lang.String stringData)
Create an octet string from the bytes of the supplied String.


SNMPOctetString

public SNMPOctetString(byte[] enc)
Create an octet string from the supplied byte array. The array may be either user-supplied, or part of a retrieved BER encoding. Note that the BER encoding of the data of an octet string is just the raw bytes.

Method Detail

getValue

public java.lang.Object getValue()
Return the array of raw bytes.

Specified by:
getValue in class SNMPObject

setValue

public void setValue(java.lang.Object data)
              throws SNMPBadValueException
Used to set the value from a byte array.

Specified by:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied.

equals

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

Overrides:
equals in class SNMPObject

hashCode

public int hashCode()
Generates a hash value so SNMP Octet String subclasses can be used in Hashtables.

Overrides:
hashCode in class SNMPObject

toString

public java.lang.String toString()
Returns a String constructed from the raw bytes. If the bytes contain non-printable ASCII characters, tant pis! (Though it's fun when the bell rings!)

Specified by:
toString in class SNMPObject

toHexString

public java.lang.String toHexString()
Returns a space-separated hex string corresponding to the raw bytes.



Copyright © 2008 AMX LLC. All Rights Reserved.