com.adventnet.snmp.snmp2
Class SnmpOpaque

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SnmpVar
        |
        +--com.adventnet.snmp.snmp2.SnmpString
              |
              +--com.adventnet.snmp.snmp2.SnmpOpaque
All Implemented Interfaces:
java.io.Serializable

public class SnmpOpaque
extends SnmpString

Class of SNMP Opaque Variable - Sub-class of SnmpString. An SnmpOpaque is used sometimes to wrap objects of other types. The SnmpVar constructor for this object allows such a usage. Decoded value of SnmpVar on such a usage of SnmpOpaque can be obtained using the decodeVariable method.

See Also:
Serialized Form

Fields inherited from class com.adventnet.snmp.snmp2.SnmpString
enc
 
Constructor Summary
SnmpOpaque(byte[] b)
          Constructs a new SnmpOpaque object by taking a byte[].
SnmpOpaque(SnmpVar var)
          Snmpvar constructor.
SnmpOpaque(java.lang.String s)
          Constructs a SnmpOpaque object by taking a string.
 
Method Summary
 SnmpVar decodeVariable()
          Returns the SnmpVar object if any wrapped inside the SnmpOpaque object.
 java.lang.String toTagString()
          Converts the value of this SnmpOpaque object to a printable string where the type is tagged before the value with a tag OPAQUE:
 
Methods inherited from class com.adventnet.snmp.snmp2.SnmpString
equals, getVarObject, toBytes, toByteString, toString, toValue
 
Methods inherited from class com.adventnet.snmp.snmp2.SnmpVar
createVariable, getError, getType, getTypeString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpOpaque

public SnmpOpaque(SnmpVar var)
Snmpvar constructor. Allows to specify var object to be wrapped in as an SnmpOpaque object.
Parameters:
var - The SnmpVar object.

SnmpOpaque

public SnmpOpaque(java.lang.String s)
Constructs a SnmpOpaque object by taking a string.
Parameters:
s - String object

SnmpOpaque

public SnmpOpaque(byte[] b)
Constructs a new SnmpOpaque object by taking a byte[].
Parameters:
b - octet string
Method Detail

toTagString

public java.lang.String toTagString()
Converts the value of this SnmpOpaque object to a printable string where the type is tagged before the value with a tag OPAQUE:
Overrides:
toTagString in class SnmpString
Returns:
the value of this SnmpOpaque object to a printable string where the type is tagged before the value with a tag OPAQUE:

decodeVariable

public SnmpVar decodeVariable()
                       throws SnmpException
Returns the SnmpVar object if any wrapped inside the SnmpOpaque object. This routine should be used only if it is certain that the contents represent an SnmpVar object. It does not guarantee the accurate results in case the object does not represent an SnmpVar.
Returns:
SnmpVar object corresponding to the contents.
Throws:
SnmpException - is thrown if contents do not represent a valid SnmpVar object.


Copyright (c)AdventNet Inc., 1996-2004