com.sun.jaw.snmp.common
Class SnmpString

java.lang.Object
  |
  +--com.sun.jaw.snmp.common.SnmpValue
        |
        +--com.sun.jaw.snmp.common.SnmpString
Direct Known Subclasses:
SnmpOpaque, SnmpStringFixed

public class SnmpString
extends SnmpValue

The SnmpString class represents an SNMP string.

See Also:
Serialized Form

Field Summary
protected  byte[] value
          This is the bytes array of the string value.
 
Constructor Summary
SnmpString()
          Constructs a new empty SnmpString.
SnmpString(byte[] v)
          Constructs a new SnmpString from the specified bytes array.
SnmpString(java.lang.Byte[] v)
          Constructs a new SnmpString from the specified Bytes array.
SnmpString(java.lang.String v)
          Constructs a new SnmpString from the specified String value.
 
Method Summary
static void appendToOid(SnmpOid source, SnmpOid dest)
          Appends an SnmpOid representing an SnmpString to another oid.
 byte[] byteValue()
          Returns the bytes array of this SnmpString.
 java.lang.Object clone()
          Clones the SnmpString object, making a copy of its data.
 SnmpValue duplicate()
          Performs a clone action.
 java.lang.String getTypeName()
          Returns a textual description of the type object.
static int nextOid(long[] index, int start)
          Scans an index oid, skips the string value and returns the position of the next value.
 java.lang.Byte[] toByte()
          Converts the string value to its array of Bytes form.
 SnmpOid toOid()
          Converts the string value to its SnmpOid form.
static SnmpOid toOid(long[] index, int start)
          Extracts the string from an index oid and returns its value converted as an SnmpOid.
 java.lang.String toString()
          Converts the string value to its String form.
 
Methods inherited from class com.sun.jaw.snmp.common.SnmpValue
toAsn1String
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected byte[] value
This is the bytes array of the string value.
Constructor Detail

SnmpString

public SnmpString()
Constructs a new empty SnmpString.

SnmpString

public SnmpString(byte[] v)
Constructs a new SnmpString from the specified bytes array.
Parameters:
v - The bytes composing the string value.

SnmpString

public SnmpString(java.lang.Byte[] v)
Constructs a new SnmpString from the specified Bytes array.
Parameters:
v - The Bytes composing the string value.

SnmpString

public SnmpString(java.lang.String v)
Constructs a new SnmpString from the specified String value.
Parameters:
v - The initialization value.
Method Detail

byteValue

public byte[] byteValue()
Returns the bytes array of this SnmpString.
Returns:
The value.

toByte

public java.lang.Byte[] toByte()
Converts the string value to its array of Bytes form.
Returns:
The array of Bytes representation of the value.

toString

public java.lang.String toString()
Converts the string value to its String form.
Returns:
The String representation of the value.
Overrides:
toString in class java.lang.Object

toOid

public SnmpOid toOid()
Converts the string value to its SnmpOid form.
Returns:
The oid representation of the value.
Overrides:
toOid in class SnmpValue

toOid

public static SnmpOid toOid(long[] index,
                            int start)
                     throws SnmpStatusException
Extracts the string from an index oid and returns its value converted as an SnmpOid.
Parameters:
index - The index array.
start - The position in the index array.
Returns:
The oid representing the string value.
Throws:
SnmpStatusException - There is no string value available at start position.

nextOid

public static int nextOid(long[] index,
                          int start)
                   throws SnmpStatusException
Scans an index oid, skips the string value and returns the position of the next value.
Parameters:
index - The index array.
start - The position in the index array.
Returns:
The position of the next value.
Throws:
SnmpStatusException - There is no string value available at start position.

appendToOid

public static void appendToOid(SnmpOid source,
                               SnmpOid dest)
Appends an SnmpOid representing an SnmpString to another oid.
Parameters:
source - An oid representing an SnmpString value.
dest - Where source should be appened.

duplicate

public final SnmpValue duplicate()
Performs a clone action. This provides a workaround for the SnmpValue interface.
Returns:
The SnmpValue clone.
Overrides:
duplicate in class SnmpValue

clone

public java.lang.Object clone()
Clones the SnmpString object, making a copy of its data.
Returns:
The Object clone.
Overrides:
clone in class java.lang.Object

getTypeName

public java.lang.String getTypeName()
Returns a textual description of the type object.
Returns:
ASN.1 textual description.
Overrides:
getTypeName in class SnmpValue