|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.snmp2.SnmpVar
This class provides the abstract methods to present a uniform interface for applications working with the SNMP variables and is the base class for all SNMP Variable class(integer, IpAddress, etc). This and all its derived classes (called variable classes) are mainly concerned mainly with creating new SNMP variables, retrieve the value of the variable both as an object and in printable form.
Some explanation regarding the relationship between toValue and getVarObject methods: These methods do the same thing in all the SnmpVar classes except SnmpIpAddress, SnmpNetworkAddress and SnmpOID. For these three and its derived classes, the getVarObject and toString do the same thing. e.g.
SnmpIpAddress | Returns IP address as String for byte[ ]
i.e 7F000001 |
Returns IP Address in dotted notation
as a String object. i.e 127.0.0.1 |
|
SnmpNetworkAddress | Same as SnmpIpAddress | Same as SnmpIpAddress | |
SnmpOID | Returns int[ ] of the OID value
i.e int [ ] = {1, 3, 6, 1, 2, 1, 1, 1} for sysDescr in RFC1213-MIB |
Returns dotted OID as String object i.e "1.3.6.1.2.1.1.1" for sysDescr in RFC1213-MIB |
For the rest of the SNMP variable classes namely SnmpBitString, SnmpCounter64, SnmpNull, SnmpInt, SnmpUnsignedInt, SnmpTimeticks, SnmpCounter, SnmpGauge, SnmpString, SnmpNsap and SnmpOpaque the toValue() and getVarObject() do the same thing.
Method Summary | |
static SnmpVar |
createVariable(java.lang.String value,
byte type)
Creates a new SnmpVar object with the specified type and value. |
byte |
getError()
![]() |
java.lang.String |
getNumericValueAsString()
This method returns the numeric value of the SNMP data types in decimal ( base 10 ) format. |
byte |
getType()
Returns type, defined by SnmpAPI types, e.g.SnmpAPI.INTEGER . |
java.lang.String |
getTypeString()
Returns type as a string, e.g.INTEGER, OCTET STRING based on the type of SnmpVar object. |
abstract java.lang.Object |
getVarObject()
Abstract method which returns value of SNMP variable as an appropriate Object type, e.g. |
abstract byte[] |
toBytes()
Abstract method to return the value as raw bytes. |
abstract java.lang.String |
toString()
Abstract method to convert to printable string used in printing variables. |
abstract java.lang.String |
toTagString()
Abstract method to convert to printable string with object type tag used in printing variables more descriptively, e.g. |
abstract java.lang.Object |
toValue()
Abstract method which returns the value of SNMP variable as an appropriate Object type, e.g. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public byte getType()
SnmpAPI
public java.lang.String getTypeString()
public byte getError()
public java.lang.String getNumericValueAsString()
public abstract java.lang.Object getVarObject()
public abstract java.lang.Object toValue()
public abstract byte[] toBytes()
public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String toTagString()
public static SnmpVar createVariable(java.lang.String value, byte type) throws SnmpException
value
- The value for creating a new SnmpVar object.type
- The SNMP type (a constant from SnmpAPI) for creating a
new SnmpVar object.
SnmpException
- is thrown when variable creation error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |