snmp
Class SNMPSequence

java.lang.Object
  extended bysnmp.SNMPObject
      extended bysnmp.SNMPSequence
Direct Known Subclasses:
SNMPMessage, SNMPPDU, SNMPv1TrapPDU, SNMPv2BulkRequestPDU, SNMPVarBindList, SNMPVariablePair

public class SNMPSequence
extends SNMPObject

One of the most important SNMP classes. Represents a sequence of other SNMP data types. Virtually all compound structures are subclasses of SNMPSequence - for example, the top-level SNMPMessage, and the SNMPPDU it contains, are both just specializations of SNMPSequence. Sequences are frequently nested within other sequences.


Field Summary
protected  java.util.Vector sequence
           
protected  byte tag
           
 
Constructor Summary
  SNMPSequence()
          Create a new empty sequence.
protected SNMPSequence(byte[] enc)
          Construct an SNMPMessage from a received ASN.1 byte representation.
  SNMPSequence(java.util.Vector v)
          Create a new SNMP sequence from the supplied Vector of SNMPObjects.
 
Method Summary
 void addSNMPObject(SNMPObject newObject)
          Add the SNMP object to the end of the sequence.
protected  void extractFromBEREncoding(byte[] enc)
           
protected  byte[] getBEREncoding()
          Return the BER encoding for the sequence.
 SNMPObject getSNMPObjectAt(int index)
          Return the SNMP object at the specified index.
 java.lang.Object getValue()
          Returns a Vector containing the SNMPObjects in the sequence.
 void insertSNMPObjectAt(SNMPObject newObject, int index)
          Insert the SNMP object at the specified position in the sequence.
 void setValue(java.lang.Object newSequence)
          Used to set the contained SNMP objects from a supplied Vector.
 int size()
          Return the number of SNMPObjects contained in the sequence.
 java.lang.String toString()
          Return a sequence of representations of the contained objects, separated by spaces and enclosed in parentheses.
 
Methods inherited from class snmp.SNMPObject
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sequence

protected java.util.Vector sequence

tag

protected byte tag
Constructor Detail

SNMPSequence

public SNMPSequence()
Create a new empty sequence.


SNMPSequence

public SNMPSequence(java.util.Vector v)
             throws SNMPBadValueException
Create a new SNMP sequence from the supplied Vector of SNMPObjects.

Throws:
SNMPBadValueException - Thrown if non-SNMP object supplied in Vector v.

SNMPSequence

protected SNMPSequence(byte[] enc)
                throws SNMPBadValueException
Construct an SNMPMessage from a received ASN.1 byte representation.

Throws:
SNMPBadValueException - Indicates invalid SNMP sequence encoding supplied.
Method Detail

getValue

public java.lang.Object getValue()
Returns a Vector containing the SNMPObjects in the sequence.

Specified by:
getValue in class SNMPObject

setValue

public void setValue(java.lang.Object newSequence)
              throws SNMPBadValueException
Used to set the contained SNMP objects from a supplied Vector.

Specified by:
setValue in class SNMPObject
Throws:
SNMPBadValueException - Indicates an incorrect object type supplied, or that the supplied Vector contains non-SNMPObjects.

size

public int size()
Return the number of SNMPObjects contained in the sequence.


addSNMPObject

public void addSNMPObject(SNMPObject newObject)
                   throws SNMPBadValueException
Add the SNMP object to the end of the sequence.

Throws:
SNMPBadValueException - Relevant only in subclasses

insertSNMPObjectAt

public void insertSNMPObjectAt(SNMPObject newObject,
                               int index)
                        throws SNMPBadValueException
Insert the SNMP object at the specified position in the sequence.

Throws:
SNMPBadValueException - Relevant only in subclasses

getSNMPObjectAt

public SNMPObject getSNMPObjectAt(int index)
Return the SNMP object at the specified index. Indices are 0-based.


getBEREncoding

protected byte[] getBEREncoding()
Return the BER encoding for the sequence.

Specified by:
getBEREncoding in class SNMPObject

extractFromBEREncoding

protected void extractFromBEREncoding(byte[] enc)
                               throws SNMPBadValueException
Throws:
SNMPBadValueException

toString

public java.lang.String toString()
Return a sequence of representations of the contained objects, separated by spaces and enclosed in parentheses.

Specified by:
toString in class SNMPObject