Package com.unboundid.asn1
Class ASN1Sequence
java.lang.Object
com.unboundid.asn1.ASN1Element
com.unboundid.asn1.ASN1Sequence
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class ASN1Sequence
extends ASN1Element
This class provides an ASN.1 sequence element, which is used to hold an
ordered set of zero or more other elements (potentially including additional
"envelope" element types like other sequences and/or sets).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ASN.1 sequence with the default BER type and no encapsulated elements.ASN1Sequence(byte type) Creates a new ASN.1 sequence with the specified BER type and no encapsulated elements.ASN1Sequence(byte type, ASN1Element... elements) Creates a new ASN.1 sequence with the specified BER type and the provided set of elements.ASN1Sequence(byte type, Collection<? extends ASN1Element> elements) Creates a new ASN.1 sequence with the specified BER type and the provided set of elements.ASN1Sequence(ASN1Element... elements) Creates a new ASN.1 sequence with the default BER type and the provided set of elements.ASN1Sequence(Collection<? extends ASN1Element> elements) Creates a new ASN.1 sequence with the default BER type and the provided set of elements. -
Method Summary
Modifier and TypeMethodDescriptionstatic ASN1SequencedecodeAsSequence(byte[] elementBytes) Decodes the contents of the provided byte array as a sequence element.static ASN1SequencedecodeAsSequence(ASN1Element element) Decodes the provided ASN.1 element as a sequence element.elements()Retrieves the set of encapsulated elements held in this sequence.voidencodeTo(ByteStringBuffer buffer) Appends an encoded representation of this ASN.1 element to the provided buffer.byte[]getValue()Retrieves the encoded value for this element.intRetrieves the number of bytes contained in the value.voidtoString(StringBuilder buffer) Appends a string representation of the value for this ASN.1 element to the provided buffer.Methods inherited from class com.unboundid.asn1.ASN1Element
decode, decodeAsBigInteger, decodeAsBitString, decodeAsBoolean, decodeAsEnumerated, decodeAsGeneralizedTime, decodeAsIA5String, decodeAsInteger, decodeAsLong, decodeAsNull, decodeAsNumericString, decodeAsObjectIdentifier, decodeAsOctetString, decodeAsPrintableString, decodeAsSequence, decodeAsSet, decodeAsUTCTime, decodeAsUTF8String, encode, encodeLength, equals, equalsIgnoreType, getType, getTypeClass, hashCode, isConstructed, readFrom, readFrom, toString, writeTo
-
Constructor Details
-
ASN1Sequence
public ASN1Sequence()Creates a new ASN.1 sequence with the default BER type and no encapsulated elements. -
ASN1Sequence
Creates a new ASN.1 sequence with the specified BER type and no encapsulated elements.- Parameters:
type- The BER type to use for this element.
-
ASN1Sequence
Creates a new ASN.1 sequence with the default BER type and the provided set of elements.- Parameters:
elements- The set of elements to include in this sequence.
-
ASN1Sequence
Creates a new ASN.1 sequence with the default BER type and the provided set of elements.- Parameters:
elements- The set of elements to include in this sequence.
-
ASN1Sequence
Creates a new ASN.1 sequence with the specified BER type and the provided set of elements.- Parameters:
type- The BER type to use for this element.elements- The set of elements to include in this sequence.
-
ASN1Sequence
Creates a new ASN.1 sequence with the specified BER type and the provided set of elements.- Parameters:
type- The BER type to use for this element.elements- The set of elements to include in this sequence.
-
-
Method Details
-
getValueLength
Retrieves the number of bytes contained in the value.- Overrides:
getValueLengthin classASN1Element- Returns:
- The number of bytes contained in the value.
-
getValue
Retrieves the encoded value for this element.- Overrides:
getValuein classASN1Element- Returns:
- The encoded value for this element.
-
encodeTo
Appends an encoded representation of this ASN.1 element to the provided buffer.- Overrides:
encodeToin classASN1Element- Parameters:
buffer- The buffer to which the encoded representation should be appended.
-
elements
Retrieves the set of encapsulated elements held in this sequence.- Returns:
- The set of encapsulated elements held in this sequence.
-
decodeAsSequence
@NotNull public static ASN1Sequence decodeAsSequence(@NotNull byte[] elementBytes) throws ASN1Exception Decodes the contents of the provided byte array as a sequence element.- Parameters:
elementBytes- The byte array to decode as an ASN.1 sequence element.- Returns:
- The decoded ASN.1 sequence element.
- Throws:
ASN1Exception- If the provided array cannot be decoded as a sequence element.
-
decodeAsSequence
@NotNull public static ASN1Sequence decodeAsSequence(@NotNull ASN1Element element) throws ASN1Exception Decodes the provided ASN.1 element as a sequence element.- Parameters:
element- The ASN.1 element to be decoded.- Returns:
- The decoded ASN.1 sequence element.
- Throws:
ASN1Exception- If the provided element cannot be decoded as a sequence element.
-
toString
Appends a string representation of the value for this ASN.1 element to the provided buffer.- Overrides:
toStringin classASN1Element- Parameters:
buffer- The buffer to which to append the information.
-