codec.asn1
Class ASN1SetOf
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--codec.asn1.ASN1AbstractCollection
|
+--codec.asn1.ASN1Set
|
+--codec.asn1.ASN1SetOf
- All Implemented Interfaces:
- ASN1Collection, ASN1CollectionOf, ASN1Type, Cloneable, Collection, Externalizable, List, Serializable
- Direct Known Subclasses:
- Attributes, Certificates
- public class ASN1SetOf
- extends ASN1Set
- implements ASN1CollectionOf
Represents an ASN.1 SEQUENCE OF type as specified in ITU-T Recommendation
X.680. The SequenceOf and SetOf types do not have default constructors in
contrast to all the other ASN1Types. The reason is that these types are never
created directly on decoding ASN.1 structures. The decoding process always
decodes Sequence and Set types because creating the appropriate SequenceOf or
SetOf type requires explicit knowledge of the syntactic structure definition.
On the other hand, if an explicit structure is given for decoding then the
SequenceOf and SetOf types are decoded properly (because they do not have to
be created and hence the decoder need not know the component type).
This implementation does not sort the elements according to their encodings
as required (in principle) by the standard. Upon decoding, all decoded
elements are kept in the order they appeared in the encoded stream.
Constraints are checked after decoding instances of this type.
- Version:
- "$Id: ASN1SetOf.java,v 1.3 2004/08/09 06:59:23 flautens Exp $"
- Author:
- Volker Roth
- See Also:
- Serialized Form
|
Constructor Summary |
|
ASN1SetOf(Class type)
Creates an instance that keeps elements of the given type. |
|
ASN1SetOf(Class type,
int capacity)
Creates an instance with the given capacity. |
protected |
ASN1SetOf(int capacity)
Creates an instance with the given capacity. |
|
ASN1SetOf(Resolver resolver)
Creates an instance that uses the given Resolver to
create new elements. |
|
ASN1SetOf(Resolver resolver,
int capacity)
Creates an instance that uses the given Resolver to
create new elements. |
|
Method Summary |
void |
decode(Decoder dec)
Reads this collection from the given Decoder. |
Class |
getElementType()
Returns the Java class representing the ASN.1 type of the elements in
this collection or ASN1Type.class
if the type cannot be
determined. |
ASN1Type |
newElement()
Creates and returns a new instance of the element type of this instance.
|
| Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, toString, writeExternal |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from interface codec.asn1.ASN1Type |
checkConstraints, encode, getConstraint, getTag, getTagClass, getValue, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
ASN1SetOf
protected ASN1SetOf(int capacity)
- Creates an instance with the given capacity. This constructor is provided
for subclasses that wish to handle creation of new elements themselves
and do not rely on an application-provided element type.
- Parameters:
capacity - The initial capacity of the set.
ASN1SetOf
public ASN1SetOf(Class type)
- Creates an instance that keeps elements of the given type. The type must
be a valid
ASN1Type. The given class must be public and
it must have a public default constructor.
- Parameters:
type - The class that represents the component type of this SET
OF.- Throws:
IllegalArgumentException - if the given class does not implement ASN1Type.NullPointerException - if type is null.
ASN1SetOf
public ASN1SetOf(Class type,
int capacity)
- Creates an instance with the given capacity.
- Parameters:
capacity - The capacity.
ASN1SetOf
public ASN1SetOf(Resolver resolver)
- Creates an instance that uses the given
Resolver to
create new elements.
- Parameters:
resolver - The resolver to use for generating elements.
ASN1SetOf
public ASN1SetOf(Resolver resolver,
int capacity)
- Creates an instance that uses the given
Resolver to
create new elements.
- Parameters:
resolver - The resolver to use for generating elements.capacity - The capacity.
getElementType
public Class getElementType()
- Returns the Java class representing the ASN.1 type of the elements in
this collection or
ASN1Type.class
if the type cannot be
determined.
- Specified by:
getElementType in interface ASN1CollectionOf
- Returns:
- The ASN.1 type of the elements in this collection.
newElement
public ASN1Type newElement()
- Creates and returns a new instance of the element type of this instance.
The freshly created instance is added to this instance automatically.
New instances are created by invoking the Resolver
instance set in this instance.
If no new instance can be created then an IllegalStateException is
thrown.
Decoders should call this method in order to create
additional elements on decoding. Subclasses may use this method to
keep track on elements added to them.
- Specified by:
newElement in interface ASN1CollectionOf
- Returns:
- A new instance of the element type of this set.
- Throws:
IllegalStateException - if no new instance could be created.
decode
public void decode(Decoder dec)
throws ASN1Exception,
IOException
- Reads this collection from the given
Decoder.
- Specified by:
decode in interface ASN1Type- Overrides:
decode in class ASN1AbstractCollection
- Parameters:
dec - The decoder to read from.
Copyright © Fraunhofer Gesellschaft. All Rights Reserved.