Class SnmpNull

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, SnmpSyntax

    public class SnmpNull
    extends java.lang.Object
    implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
    Implements the SNMP Null object as defined by the SNMPv1 and SNMPv2 SMI. The object has no data or length, but is encoded with a specific header. Often used as the value portion of an SnmpVarBind when sending a GET, GETNEXT, etc to a remote agent. This class manages no internal data, but is derived to provide the proper encoding and handling of SNMP Null datatypes.
    Author:
    Brian Weaver
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte ASNTYPE
      Defines the ASN.1 value for the SnmpNull class.
    • Constructor Summary

      Constructors 
      Constructor Description
      SnmpNull()
      Constructs a default SnmpNull class
      SnmpNull​(SnmpNull second)
      Copy constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Used to get a duplicate of the current object so that it can be modified without affecting the creating object.
      int decodeASN​(byte[] buf, int offset, AsnEncoder encoder)
      Used to decode the null value from the ASN.1 buffer.
      SnmpSyntax duplicate()
      Used to get a duplicate of the current object so that it can be modified without affecting the creating object.
      int encodeASN​(byte[] buf, int offset, AsnEncoder encoder)
      Used to encode the null value into an ASN.1 buffer.
      java.lang.String toString()
      Returns a string representation of the SNMP Null object
      byte typeId()
      Used to retreive the ASN.1 type for this object.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ASNTYPE

        public static final byte ASNTYPE
        Defines the ASN.1 value for the SnmpNull class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SnmpNull

        public SnmpNull()
        Constructs a default SnmpNull class
      • SnmpNull

        public SnmpNull​(SnmpNull second)
        Copy constructor. Provided so that if the class is extended or should at some point manage internal data, the data could be meaningfully copied from the passed object.
        Parameters:
        second - The class object to set data from.
    • Method Detail

      • typeId

        public byte typeId()
        Used to retreive the ASN.1 type for this object.
        Specified by:
        typeId in interface SnmpSyntax
        Returns:
        The ASN.1 value for the SnmpNull
      • encodeASN

        public int encodeASN​(byte[] buf,
                             int offset,
                             AsnEncoder encoder)
                      throws AsnEncodingException
        Used to encode the null value into an ASN.1 buffer. The passed encoder defines the method for encoding the data.
        Specified by:
        encodeASN in interface SnmpSyntax
        Parameters:
        buf - The location to write the encoded data
        offset - The start of the encoded buffer.
        encoder - The ASN.1 encoder object
        Returns:
        The byte immediantly after the last encoded byte.
        Throws:
        AsnEncodingException - Thrown if an encoding error occurs
      • decodeASN

        public int decodeASN​(byte[] buf,
                             int offset,
                             AsnEncoder encoder)
                      throws AsnDecodingException
        Used to decode the null value from the ASN.1 buffer. The passed encoder is used to decode the ASN.1 information.
        Specified by:
        decodeASN in interface SnmpSyntax
        Parameters:
        buf - The encoded ASN.1 data
        offset - The offset of the first byte of data
        encoder - The ASN.1 decoder object.
        Returns:
        The byte immediantly after the last decoded byte of information.
        Throws:
        AsnDecodingException - Thrown if an encoding error occurs
      • duplicate

        public SnmpSyntax duplicate()
        Used to get a duplicate of the current object so that it can be modified without affecting the creating object.
        Specified by:
        duplicate in interface SnmpSyntax
        Returns:
        A duplicate of the current object.
      • clone

        public java.lang.Object clone()
        Used to get a duplicate of the current object so that it can be modified without affecting the creating object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        A duplicate of the current object.
      • toString

        public java.lang.String toString()
        Returns a string representation of the SNMP Null object
        Overrides:
        toString in class java.lang.Object