Module org.snmp4j
Package org.snmp4j

Class ScopedPDU

java.lang.Object
org.snmp4j.PDU
org.snmp4j.ScopedPDU
All Implemented Interfaces:
Serializable, BERSerializable

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

    • ScopedPDU

      public ScopedPDU()
      Create a empty ScopedPDU.
    • ScopedPDU

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

    • 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:
      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(OutputStream outputStream) throws 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:
      IOException - if an error occurs while writing to the stream.
    • clone

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

      public void decodeBER(BERInputStream inputStream) throws 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:
      IOException - if there is a BER encoding error or other IO exception in the input stream.
    • toString

      public 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(Object obj)
      Overrides:
      equals in class PDU