org.opends.server.protocols.asn1
Class ASN1Sequence

java.lang.Object
  extended by org.opends.server.protocols.asn1.ASN1Element
      extended by org.opends.server.protocols.asn1.ASN1Sequence
All Implemented Interfaces:
java.io.Serializable, ProtocolElement

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class ASN1Sequence
extends ASN1Element

This class defines the data structures and methods to use when interacting with ASN.1 sequence elements.

See Also:
Serialized Form

Constructor Summary
ASN1Sequence()
          Creates a new ASN.1 sequence element with the default type no value.
ASN1Sequence(java.util.ArrayList<ASN1Element> elements)
          Creates a new ASN.1 sequence with the default type and the provided set of elements.
ASN1Sequence(byte type)
          Creates a new ASN.1 sequence element with the specified type and no value.
ASN1Sequence(byte type, java.util.ArrayList<ASN1Element> elements)
          Creates a new ASN.1 sequence with the specified type and the provided set of elements.
 
Method Summary
static ASN1Sequence decodeAsSequence(ASN1Element element)
          Decodes the provided ASN.1 element as a sequence element.
static ASN1Sequence decodeAsSequence(byte[] encodedElement)
          Decodes the provided byte array as an ASN.1 sequence element.
static ASN1Sequence decodeAsSequence(byte type, byte[] encodedValue)
          Decodes the provided information as an ASN.1 sequence.
 java.util.ArrayList<ASN1Element> elements()
          Retrieves the set of elements contained in this ASN.1 sequence.
 void setElements(java.util.ArrayList<ASN1Element> elements)
          Specifies the set of elements for this ASN.1 sequence.
 void setValue(byte[] value)
          Specifies the value for this ASN.1 sequence element.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this ASN.1 sequence element to the provided buffer.
 void toString(java.lang.StringBuilder buffer, int indent)
          Appends a string representation of this protocol element to the provided buffer.
 
Methods inherited from class org.opends.server.protocols.asn1.ASN1Element
decode, decode, decodeAsBoolean, decodeAsEnumerated, decodeAsInteger, decodeAsLong, decodeAsNull, decodeAsOctetString, decodeAsSequence, decodeAsSet, decodeElements, encode, encodeLength, encodeLongValue, encodeValue, encodeValue, encodeValue, equals, equalsElement, equalsIgnoreType, equalsIgnoreType, getProtocolElementName, getType, hashCode, isApplicationSpecific, isConstructed, isContextSpecific, isPrimitive, isPrivate, isUniversal, setType, setValueInternal, toString, value
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASN1Sequence

public ASN1Sequence()
Creates a new ASN.1 sequence element with the default type no value.


ASN1Sequence

public ASN1Sequence(byte type)
Creates a new ASN.1 sequence element with the specified type and no value.

Parameters:
type - The BER type for this ASN.1 sequence.

ASN1Sequence

public ASN1Sequence(java.util.ArrayList<ASN1Element> elements)
Creates a new ASN.1 sequence with the default type and the provided set of elements.

Parameters:
elements - The set of elements to include in this sequence.

ASN1Sequence

public ASN1Sequence(byte type,
                    java.util.ArrayList<ASN1Element> elements)
Creates a new ASN.1 sequence with the specified type and the provided set of elements.

Parameters:
type - The BER type for this sequence.
elements - The set of elements to include in this sequence.
Method Detail

elements

public java.util.ArrayList<ASN1Element> elements()
Retrieves the set of elements contained in this ASN.1 sequence. The returned list must not be modified by the caller.

Returns:
The set of elements contained in this ASN.1 sequence.

setElements

public void setElements(java.util.ArrayList<ASN1Element> elements)
Specifies the set of elements for this ASN.1 sequence.

Parameters:
elements - The set of elements for this ASN.1 sequence.

setValue

public void setValue(byte[] value)
              throws ASN1Exception
Specifies the value for this ASN.1 sequence element.

Overrides:
setValue in class ASN1Element
Parameters:
value - The encoded value for this ASN.1 sequence element.
Throws:
ASN1Exception - If the provided array is null or cannot be decoded as a set of ASN.1 elements.

decodeAsSequence

public static ASN1Sequence decodeAsSequence(ASN1Element element)
                                     throws ASN1Exception
Decodes the provided ASN.1 element as a sequence element.

Parameters:
element - The ASN.1 element to decode as a sequence element.
Returns:
The decoded ASN.1 sequence element.
Throws:
ASN1Exception - If the provided ASN.1 element cannot be decoded as a sequence element.

decodeAsSequence

public static ASN1Sequence decodeAsSequence(byte[] encodedElement)
                                     throws ASN1Exception
Decodes the provided byte array as an ASN.1 sequence element.

Parameters:
encodedElement - The byte array to decode as an ASN.1 sequence element.
Returns:
The decoded ASN.1 sequence element.
Throws:
ASN1Exception - If the provided byte array cannot be decoded as an ASN.1 sequence element.

decodeAsSequence

public static ASN1Sequence decodeAsSequence(byte type,
                                            byte[] encodedValue)
                                     throws ASN1Exception
Decodes the provided information as an ASN.1 sequence.

Parameters:
type - The BER type to use for the sequence.
encodedValue - The encoded value to decode as the set of elements for the sequence.
Returns:
The decoded ASN.1 sequence element.
Throws:
ASN1Exception - If the provided byte array cannot be decoded as an ASN.1 sequence element.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this ASN.1 sequence element to the provided buffer.

Specified by:
toString in interface ProtocolElement
Overrides:
toString in class ASN1Element
Parameters:
buffer - The buffer to which the information should be appended.

toString

public void toString(java.lang.StringBuilder buffer,
                     int indent)
Appends a string representation of this protocol element to the provided buffer.

Specified by:
toString in interface ProtocolElement
Overrides:
toString in class ASN1Element
Parameters:
buffer - The buffer into which the string representation should be written.
indent - The number of spaces that should be used to indent the resulting string representation.