com.adventnet.snmp.snmp2
Class SnmpNull
java.lang.Object
|
+--com.adventnet.snmp.snmp2.SnmpVar
|
+--com.adventnet.snmp.snmp2.SnmpNull
- public class SnmpNull
- extends SnmpVar
Class of SNMP Null Variable - Sub-class of SnmpVar.
This class can be used to created a SnmpVar object of type SnmpNull.
It also has methods to retrieve the value in different forms(eg. String,
byte). The SnmpNull type is used as a placeholder.
Additionally it can take up the error indication for a particular OID.
i.e SnmpAPI.NOSUCHOBJECTEXP, SnmpAPI.NOSUCHINSTANCEEXP,
or SnmpAPI.ENDOFMIBVIEWEXP.
- See Also:
- Serialized Form
|
Field Summary |
(package private) byte[] |
byteValue
|
(package private) int |
value
|
|
Constructor Summary |
SnmpNull()
Creates an SnmpNull object with the value 0. |
SnmpNull(byte val)
Creates an SnmpNull object. |
|
Method Summary |
(package private) int |
encode(byte[] buff,
int space)
ASN encoder |
java.lang.String |
getNumericValueAsString()
This method will throw UnsupportedOperationException since this
is not a numeric data type. |
java.lang.Object |
getVarObject()
Returns the value of this SnmpNull object as an appropriate Object type,
in this case returns null. |
byte[] |
toBytes()
Returns the value of this SnmpNull object as null with return type
byte[]. |
java.lang.String |
toString()
Converts value of this SnmpNull object to a printable string. |
java.lang.String |
toTagString()
Converts the value of this SnmpNull object to a printable string
where the type is tagged before the value with the appropriate tag
Type. |
java.lang.Object |
toValue()
Returns the value of this SnmpNull object as an appropriate Object type,
in this case returns null. |
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
value
int value
byteValue
byte[] byteValue
SnmpNull
public SnmpNull()
- Creates an SnmpNull object with the value 0.
SnmpNull
public SnmpNull(byte val)
- Creates an SnmpNull object. Null Objects in Snmpv2c
and Snmpv3 can take up additionally the error indication
for the particular oid.
- Parameters:
val - could be any of SnmpAPI.NOSUCHOBJECTEXP ,
SnmpAPI.NOSUCHINSTANCEEXP,
or SnmpAPI.ENDOFMIBVIEWEXP.
getVarObject
public java.lang.Object getVarObject()
- Returns the value of this SnmpNull object as an appropriate Object type,
in this case returns null. This method is the same as toValue().
- Overrides:
- getVarObject in class SnmpVar
- Returns:
- the value of this SnmpNull object as a null value.
toValue
public java.lang.Object toValue()
- Returns the value of this SnmpNull object as an appropriate Object type,
in this case returns null.
- Overrides:
- toValue in class SnmpVar
- Returns:
- the value of this SnmpNull object as null value.
toString
public java.lang.String toString()
- Converts value of this SnmpNull object to a printable string.
Returns a string with value "NULL".
- Overrides:
- toString in class SnmpVar
- Returns:
- the value of this SnmpNull as a printable string as "NULL".
toTagString
public java.lang.String toTagString()
- Converts the value of this SnmpNull object to a printable string
where the type is tagged before the value with the appropriate tag
Type. The tag type can be any of the SnmpVar types(i.e STRING,
INTEGER, etc.).
- Overrides:
- toTagString in class SnmpVar
- Returns:
- the value of this SnmpNull object to a printable string
where the type is tagged before the value with the appropriate tag type.
toBytes
public byte[] toBytes()
- Returns the value of this SnmpNull object as null with return type
byte[].
- Overrides:
- toBytes in class SnmpVar
- Returns:
- the value of this SnmpNull object as null with return type
byte[].
getNumericValueAsString
public java.lang.String getNumericValueAsString()
- This method will throw UnsupportedOperationException since this
is not a numeric data type.
- Overrides:
- getNumericValueAsString in class SnmpVar
- Returns:
- Nothing is returned since this method throws an exception.
- Throws:
- java.lang.UnsupportedOperationException - Since this
is not a numeric data type.
encode
int encode(byte[] buff,
int space)
throws java.lang.ArrayIndexOutOfBoundsException
- ASN encoder
- Overrides:
- encode in class SnmpVar
- Parameters:
buff - The buffer into which the value is to be encodedspace - The number of free bytes in the buffer- Returns:
- The number of free bytes in the buffer
- Throws:
- java.lang.ArrayIndexOutOfBoundsException - When there is
insufficient space in buffer