|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.snmp2.SnmpVar | +--com.adventnet.snmp.snmp2.SnmpString
Class of SNMP String Variable - Sub-class of SnmpVar. This class can be used to create an SnmpVar object of type SnmpString. It also has methods to retrieve the value in different forms(eg. String, byte). Some Notes : A hex string can also be specified in the constructor of this object. To do so just enclose the string within single quotes with each byte separated by a colon. For example for 0x09a2bec3 use new SnmpString("'09:a2:be:c3'").
All the String encoding will be done based on the encoding set in the SnmpAPI. The default encoding string will be ISO8859_1 which is the standard one. To avoid any kind of problems with String encoding, one can also use the new SnmpString(byte[] b) for creating and toBytes() method for retrieving the values of SnmpVar objects. With these methods none of the String encoding routines in java is used. Instead it uses the bytes directly.
Field Summary | |
static java.lang.String |
enc
The Standard encoding string on which all encoding will be done. |
Constructor Summary | |
protected |
SnmpString()
Constuctor to keep subclasses happy |
|
SnmpString(byte[] b)
Constructs a new SnmpString with the specified byte array of octect string. |
|
SnmpString(java.lang.String s)
Constructs a new SnmpString with initial value = s . |
|
SnmpString(java.lang.String s,
java.lang.String enc)
Constructs a new SnmpString with initial value = s and encoding enc. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Returns true if both the SnmpString objects are equal. |
java.lang.Object |
getVarObject()
Returns the value of this SnmpString object as a printable string object. |
byte[] |
toBytes()
To return the value of this SnmpString object as raw bytes. |
java.lang.String |
toByteString()
To convert the value of this SnmpString object to a printable HEX string. |
java.lang.String |
toString()
To convert the value of this SnmpString object to a printable string |
java.lang.String |
toTagString()
To convert the value of this SnmpString object to a printable string where the type is tagged before the value with a tag STRING:. |
java.lang.Object |
toValue()
Returns the value of this SnmpString object as a printable string object. |
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 |
Field Detail |
public static java.lang.String enc
Constructor Detail |
protected SnmpString()
public SnmpString(java.lang.String s)
s
- The string value for creating a new SnmpString object.public SnmpString(java.lang.String s, java.lang.String enc)
s
- The value for this SnmpString object.enc
- The string for the encoding scheme to be used.public SnmpString(byte[] b)
b
- The byte array of octet stringMethod Detail |
public java.lang.Object getVarObject()
getVarObject
in class SnmpVar
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the SnmpString object which is to be checked for equality.public java.lang.Object toValue()
toValue
in class SnmpVar
public java.lang.String toString()
toString
in class SnmpVar
public java.lang.String toTagString()
toTagString
in class SnmpVar
public java.lang.String toByteString()
public byte[] toBytes()
toBytes
in class SnmpVar
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |