com.outbackinc.services.protocol.snmp
Class SnmpVarBind

java.lang.Object
  |
  +--com.outbackinc.services.protocol.snmp.SnmpVarBind
All Implemented Interfaces:
java.io.Serializable

public class SnmpVarBind
extends java.lang.Object
implements java.io.Serializable

Variable Binding. contains a name, type and value for an SNMP object. The SNMP ASN.1 types are mapped to Java types via the getType() and getValue() methods as follows:

 
ASN.1
SnmpConstants
Java
NULL
ASN_NULL
null
INTEGER and Integer32
ASN_INTEGER and ASN_INTEGER32
java.math.BigInteger
OCTET STRING
ASN_OCTSTR
byte[ ]
Opaque
ASN_OPAQUE
byte[ ]
IpAddress
ASN_IPADDRESS
java.lang.String
OBJECT IDENTIFIER
ASN_OID
java.lang.String
Counter and Counter32
ASN_COUNTER and ASN_COUNTER32
java.lang.Long
Gauge, Gauge32, and Unsigned32
ASN_GAUGE, ASN_GAUGE32, and ASN_UNSIGNED32
java.lang.Long
TimeTicks
ASN_TIMETICKS
java.lang.Long
Counter64
ASN_COUNTER64
java.math.BigInteger
UInteger32 (historic)
ASN_UINTEGER32
java.lang.Long

See Also:
SnmpConstants, Serialized Form

Constructor Summary
SnmpVarBind(java.lang.String szName, byte bType, java.lang.Object cValueObject)
          Create an SnmpVarBind with a byte type
SnmpVarBind(java.lang.String szName, short sType, java.lang.Object cValueObject)
          Create an SnmpVarBind with a short type
 
Method Summary
 java.lang.String getName()
          Get the OID name for this varbind.
 java.lang.String getStringValue()
          Get the varbind value as a String.
 long getTimeStamp()
          Get the timestamp associated with this varbind.
 byte getType()
          Get the ASN type for this varbind.
 java.lang.Object getValue()
          Get the object value for this varbind.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpVarBind

public SnmpVarBind(java.lang.String szName,
                   byte bType,
                   java.lang.Object cValueObject)
Create an SnmpVarBind with a byte type
Parameters:
szName - Typically the OID
bType - Variable type (display string, counter, etc.)
cValueObject - The value of the variable

SnmpVarBind

public SnmpVarBind(java.lang.String szName,
                   short sType,
                   java.lang.Object cValueObject)
Create an SnmpVarBind with a short type
Parameters:
szName - Typically the OID
sType - Variable type (display string, counter, etc.)
cValueObject - The value of the variable
Method Detail

getTimeStamp

public long getTimeStamp()
Get the timestamp associated with this varbind. The timestamp corresponds to the agent sysUpTime.0 value when the varbind was retrieved from the agent, expressed in seconds. The value 0 is returned if timeStampRetrieval has been disabled.
Returns:
timestamp
See Also:
SnmpServiceConfiguration

getName

public java.lang.String getName()
Get the OID name for this varbind.
Returns:
the OID in dotted decimal format.

getType

public byte getType()
Get the ASN type for this varbind.
Returns:
a constant from SnmpConstants
See Also:
SnmpConstants

getValue

public java.lang.Object getValue()
Get the object value for this varbind. The value is returned as an object in order to provide a generic API. However, the return value may be safely typecast to a specific Java type by first using getType() to determine the correct type.
Returns:
the object value
See Also:
getType(), SnmpConstants

getStringValue

public java.lang.String getStringValue()
Get the varbind value as a String. SnmpConstants.ASN_OPAQUE and SnmpConstants.ASN_OCTSTR with "non-printable" bytes will be represented as a hex string (i.e., "0xab,0x00,0x06"). "Non-printable" bytes are those that are greater than 0x7e or less than 0x20 in value excepting HT (0x09), CR (0x0d), and LF (0x0a).
Returns:
varbind value as a string


Home  Services  Products  Purchase  Contact Us  About Us  Legal  Ceramics
Copyright © 2003-2008 jSNMP Enterprises All rights reserved.