Module org.snmp4j
Package org.snmp4j

Class ScopedPDU

  • All Implemented Interfaces:
    java.io.Serializable, BERSerializable

    public class ScopedPDU
    extends PDU
    The ScopedPDU class represents a SNMPv3 scoped PDU.
    Version:
    1.0
    Author:
    Frank Fock
    See Also:
    Serialized Form
    • Constructor Detail

      • ScopedPDU

        public ScopedPDU()
        Create a empty ScopedPDU.
      • ScopedPDU

        public ScopedPDU​(ScopedPDU other)
        Copy constructor.
        Parameters:
        other - a ScopedPDU instance.
    • Method Detail

      • setContextEngineID

        public void setContextEngineID​(OctetString contextEngineID)
        Sets the context engine ID field of the scoped PDU.
        Parameters:
        contextEngineID - an OctetString instance (must not be null).
        Throws:
        java.lang.NullPointerException - if contextEngineID == null
      • getContextEngineID

        public OctetString getContextEngineID()
        Gets the context engine ID of this scoped PDU.
        Returns:
        an OctetString instance.
      • setContextName

        public void setContextName​(OctetString contextName)
        Sets the context name field of this scoped PDU.
        Parameters:
        contextName - an OctetString instance (must not be null).
      • getContextName

        public OctetString getContextName()
        Gets the context name of this scoped PDU.
        Returns:
        an OctetString instance.
      • getBERLength

        public int getBERLength()
        Description copied from interface: BERSerializable
        Returns the length of this BERSerializable object in bytes when encoded according to the Basic Encoding Rules (BER).
        Specified by:
        getBERLength in interface BERSerializable
        Overrides:
        getBERLength in class PDU
        Returns:
        the BER encoded length of this variable.
      • getBERPayloadLength

        public int getBERPayloadLength()
        Description copied from interface: BERSerializable
        Returns the length of the payload of this BERSerializable object in bytes when encoded according to the Basic Encoding Rules (BER).
        Specified by:
        getBERPayloadLength in interface BERSerializable
        Overrides:
        getBERPayloadLength in class PDU
        Returns:
        the BER encoded length of this variable.
      • encodeBER

        public void encodeBER​(java.io.OutputStream outputStream)
                       throws java.io.IOException
        Description copied from interface: BERSerializable
        Encodes a Variable to an OutputStream.
        Specified by:
        encodeBER in interface BERSerializable
        Overrides:
        encodeBER in class PDU
        Parameters:
        outputStream - an OutputStream.
        Throws:
        java.io.IOException - if an error occurs while writing to the stream.
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class PDU
      • decodeBER

        public void decodeBER​(BERInputStream inputStream)
                       throws java.io.IOException
        Decodes a ScopedPDU from an InputStream.
        Specified by:
        decodeBER in interface BERSerializable
        Overrides:
        decodeBER in class PDU
        Parameters:
        inputStream - an InputStream containing a BER encoded byte stream.
        Throws:
        java.io.IOException - if there is a BER encoding error or other IO exception in the input stream.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class PDU
        Returns:
        a string representation of the object.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class PDU