Class SnmpV2Error

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, SnmpSyntax
    Direct Known Subclasses:
    SnmpEndOfMibView, SnmpNoSuchInstance, SnmpNoSuchObject

    public abstract class SnmpV2Error
    extends java.lang.Object
    implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
    This class provides the base class for the SNMP V2 error class. In SNMPv2 an agent may respond to individual variables with one of three errors: End-of-Mib-View, No-Such-Instance, or No-Such-Object. Each of the error conditions are derived from this base class. By responding to error in this way the agent can still return valid variables while informing the manager of the variables in error. For more information see "SNMP, SNMPv2, SNMPv3, and RMON 1 and 2, 3rd Ed" by William Stallings. (ISBN 0-201-48534-6)
    Version:
    1.1.1.1
    Author:
    Brian Weaver
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.Object clone()
      Returns a duplicate of the current object.
      int decodeASN​(byte[] buf, int offset, AsnEncoder encoder)
      Decodes the passed buffer and updates the object to match the encoded information.
      abstract SnmpSyntax duplicate()
      Returns a duplicate of the current object.
      int encodeASN​(byte[] buf, int offset, AsnEncoder encoder)
      Encodes the SNMPv2 error into the passed buffer using the encoder object.
      abstract byte typeId()
      Returns the ASN.1 type identifier for the SNMPv2 error.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SnmpV2Error

        public SnmpV2Error()
        Default constructor. Provided to give the derived classes a meaningful way to initialize themself by calling super(). The method performs no useful function.
      • SnmpV2Error

        public SnmpV2Error​(SnmpV2Error second)
        Copy constructor. Provided to give the derived classes a meaningful way to initialize themself by calling super(second). The method performs no useful fuction.
        Parameters:
        second - The object to copy to self
    • Method Detail

      • typeId

        public abstract byte typeId()
        Returns the ASN.1 type identifier for the SNMPv2 error. Defined abstract to fulfill the interface contract.
        Specified by:
        typeId in interface SnmpSyntax
        Returns:
        The ASN.1 type identifier
      • encodeASN

        public int encodeASN​(byte[] buf,
                             int offset,
                             AsnEncoder encoder)
                      throws AsnEncodingException
        Encodes the SNMPv2 error into the passed buffer using the encoder object. If an encoding exception occurs then an exception is thrown.
        Specified by:
        encodeASN in interface SnmpSyntax
        Parameters:
        buf - The buffer to store encoded bytes
        offset - The start of the encoding location
        encoder - The encoding object
        Returns:
        The index of the byte immedantly 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
        Decodes the passed buffer and updates the object to match the encoded information. The encoded information is recovered using the encoder object.
        Specified by:
        decodeASN in interface SnmpSyntax
        Parameters:
        buf - The encoded buffer
        offset - The offset of the first byte of encoded data
        encoder - The object used to decode the data.
        Returns:
        The index of the byte immedantly after the last encoded byte.
        Throws:
        AsnDecodingException - Thrown if an encoding error occurs
      • duplicate

        public abstract SnmpSyntax duplicate()
        Returns a duplicate of the current object. The duplicate object is a new object and any changes will not be reflected in the source object. This is identical to creating a new object using the copy constructor.
        Specified by:
        duplicate in interface SnmpSyntax
        Returns:
        A newly created object that is a duplicate of self.
      • clone

        public abstract java.lang.Object clone()
        Returns a duplicate of the current object. The duplicate object is a newly created object and any changes made to the returned object will not be reflected in the source.
        Overrides:
        clone in class java.lang.Object
        Returns:
        A newly created object that is a duplicate of self