com.sun.slamd.asn1
Class ASN1Set

java.lang.Object
  extended bycom.sun.slamd.asn1.ASN1Element
      extended bycom.sun.slamd.asn1.ASN1Set

public class ASN1Set
extends ASN1Element

This class defines an ASN.1 element that serves as a set, whose value is an unordered set of other ASN.1 elements.


Field Summary
static ASN1Element[] NO_ELEMENTS
          The set of elements that will be used if there are no elements.
 
Fields inherited from class com.sun.slamd.asn1.ASN1Element
ASN1_BOOLEAN_TYPE, ASN1_ENUMERATED_TYPE, ASN1_INTEGER_TYPE, ASN1_NULL_TYPE, ASN1_OCTET_STRING_TYPE, ASN1_SEQUENCE_TYPE, ASN1_SET_TYPE, EMPTY_BYTES
 
Constructor Summary
ASN1Set()
          Creates a new ASN.1 set with no elements encoded in the value.
ASN1Set(ASN1Element[] elements)
          Creates a new ASN.1 set to hold the specified set of ASN.1 elements.
ASN1Set(byte type)
          Creates a new ASN.1 set with the specified type and no elements encoded in the value.
ASN1Set(byte type, ASN1Element[] elements)
          Creates a new ASN.1 set with the given type to hold the specified set of ASN.1 elements.
 
Method Summary
 void addElement(ASN1Element element)
          Adds the specified ASN.1 element to the set of elements encoded in this set.
static ASN1Set decodeAsSet(byte[] encodedValue)
          Decodes the provided byte array as an ASN.1 set element.
 ASN1Element[] getElements()
          Retrieves the set of elements that are encoded in this ASN.1 set.
 void removeAllElements()
          Removes all elements encoded in the value of this ASN.1 element.
 void replaceElements(ASN1Element element)
          Replaces the current set of elements with the provided ASN.1 element.
 void replaceElements(ASN1Element[] elements)
          Replaces the current set of elements with the provided set.
 java.lang.String toString(int indent)
          Retrieves a string representation of this ASN.1 set.
 
Methods inherited from class com.sun.slamd.asn1.ASN1Element
byteArrayToInt, byteArrayToString, byteArrayToString, decode, decodeAsBoolean, decodeAsBoolean, decodeAsEnumerated, decodeAsEnumerated, decodeAsInteger, decodeAsInteger, decodeAsNull, decodeAsNull, decodeAsOctetString, decodeAsOctetString, decodeAsSequence, decodeAsSequence, decodeAsSet, decodeLength, encode, encode, encodeLength, getBytes, getType, getTypeWithoutFlags, getValue, setType, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ELEMENTS

public static final ASN1Element[] NO_ELEMENTS
The set of elements that will be used if there are no elements.

Constructor Detail

ASN1Set

public ASN1Set()
Creates a new ASN.1 set with no elements encoded in the value.


ASN1Set

public ASN1Set(byte type)
Creates a new ASN.1 set with the specified type and no elements encoded in the value.

Parameters:
type - The type to use for this ASN.1 set.

ASN1Set

public ASN1Set(ASN1Element[] elements)
Creates a new ASN.1 set to hold the specified set of ASN.1 elements.

Parameters:
elements - The set of ASN.1 elements to encode in the value of this set.

ASN1Set

public ASN1Set(byte type,
               ASN1Element[] elements)
Creates a new ASN.1 set with the given type to hold the specified set of ASN.1 elements.

Parameters:
type - The type to use for this ASN.1 set.
elements - The set of ASN.1 elements to encode in the value of this set.
Method Detail

getElements

public ASN1Element[] getElements()
Retrieves the set of elements that are encoded in this ASN.1 set.

Returns:
The set of elements that are encoded in this ASN.1 set.

addElement

public void addElement(ASN1Element element)
Adds the specified ASN.1 element to the set of elements encoded in this set.

Parameters:
element - The ASN.1 element to include in the set of elements encoded in this set.

removeAllElements

public void removeAllElements()
Removes all elements encoded in the value of this ASN.1 element.


replaceElements

public void replaceElements(ASN1Element element)
Replaces the current set of elements with the provided ASN.1 element.

Parameters:
element - The ASN.1 element to use to replace the existing set of elements encoded in this set.

replaceElements

public void replaceElements(ASN1Element[] elements)
Replaces the current set of elements with the provided set.

Parameters:
elements - The set of ASN.1 elements to use to replace the existing set of elements encoded in this set.

decodeAsSet

public static ASN1Set decodeAsSet(byte[] encodedValue)
                           throws ASN1Exception
Decodes the provided byte array as an ASN.1 set element.

Parameters:
encodedValue - The encoded ASN.1 element.
Returns:
The decoded ASN.1 set element.
Throws:
ASN1Exception - If the provided byte array cannot be decoded as an ASN.1 set element.

toString

public java.lang.String toString(int indent)
Retrieves a string representation of this ASN.1 set. It will recursively display string representations for each of the elements.

Overrides:
toString in class ASN1Element
Parameters:
indent - The number of spaces to indent the information in the returned string.
Returns:
A string representation of this ASN.1 set