snmp
Class SNMPSequence

java.lang.Object
  |
  +--snmp.SNMPObject
        |
        +--snmp.SNMPSequence
Direct Known Subclasses:
SNMPMessage, SNMPPDU, 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  int type
           
 
Constructor Summary
SNMPSequence()
          Create a new empty sequence.
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)
           
 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 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sequence

protected java.util.Vector sequence

type

protected int type
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

public 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.
Overrides:
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.
Overrides:
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

getSNMPObjectAt

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

getBEREncoding

public byte[] getBEREncoding()
Return the BER encoding for the sequence.
Overrides:
getBEREncoding in class SNMPObject

extractFromBEREncoding

protected void extractFromBEREncoding(byte[] enc)
                               throws SNMPBadValueException

toString

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