|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--codec.asn1.ASN1AbstractCollection
Represents an abstract collection of ASN.1 types such as a SEQUENCE or a SET. Since this class inherits from the Collection framework class ArrayList, ASN.1 types may be added conveniently just as object instances are added to a list.
Please note that constraints of collections are validated before encoding and after decoding. Invalid modification of a collection type can be detected on importing and exporting abstract collections. On DER encoding a collection its constraint is validated twice since the DER encoding is a two-pass process.
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
ASN1AbstractCollection()
Method declarations with default implementation. |
|
ASN1AbstractCollection(int capacity)
Creates an instance with the given capacity. |
|
| Method Summary | |
void |
checkConstraints()
Checks the constraint on this type if it is set. |
void |
decode(Decoder dec)
Reads this collection from the given Decoder. |
void |
encode(Encoder enc)
Writes this collection to the given encoder. |
Collection |
getCollection()
Returns the Java type that corresponds to this ASN.1 type. |
Constraint |
getConstraint()
Returns the Constraint of this type or
null if there is none. |
abstract int |
getTag()
Abstract method declarations. |
int |
getTagClass()
This default implementation returns UNIVERSAL. |
Object |
getValue()
Returns the Java type that corresponds to this ASN.1 type. |
boolean |
isExplicit()
|
boolean |
isOptional()
|
boolean |
isType(int tag,
int tagclass)
Returns true if the given tag and tag class matches the
tag and tag class of this instance. |
void |
readExternal(ObjectInput in)
The writeExternal and readExternal methods of the Externalizable interface are implemented by a class to give the serializable class complete control over the format and contents of the stream for an object and its supertypes. |
void |
setConstraint(Constraint constraint)
Sets the Constraint of this type. |
void |
setExplicit(boolean explicit)
Sets the tagging of this type as either EXPLICIT or IMPLICIT. |
void |
setOptional(boolean optional)
Optional types may be present in an encoding but they need not be. |
String |
toString()
Prints this collection. |
void |
writeExternal(ObjectOutput out)
The writeExternal and readExternal methods of the Externalizable interface are implemented by a class to give the serializable class complete control over the format and contents of the stream for an object and its supertypes. |
| 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 class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
| Constructor Detail |
public ASN1AbstractCollection()
public ASN1AbstractCollection(int capacity)
capacity - The capacity.| Method Detail |
public abstract int getTag()
getTag in interface ASN1Typepublic Object getValue()
getValue in interface ASN1Typepublic Collection getCollection()
getCollection in interface ASN1Collectionpublic void setOptional(boolean optional)
setOptional in interface ASN1Typeoptional - true iff this type is optional.public boolean isOptional()
isOptional in interface ASN1Typetrue iff this type is optional.public int getTagClass()
UNIVERSAL.getTagClass in interface ASN1Typepublic void setExplicit(boolean explicit)
setExplicit in interface ASN1Typeexplicit - true if this type shall be tagged EXPLICIT
and false if it shall be encoded IMPLICIT.public boolean isExplicit()
isExplicit in interface ASN1Typetrue if this type is tagged EXPLICIT and
false if it is tagged IMPLICIT.public void setConstraint(Constraint constraint)
Constraint of this type. For instance an
ASN.1 INTEGER might be constrained to a certain range such as INTEGER
(0..99). null can be passed as a constraint which disables
constraint checking.setConstraint in interface ASN1Typeconstraint - The Constraint of this type.public Constraint getConstraint()
Constraint of this type or
null if there is none.getConstraint in interface ASN1Typenull.
public void checkConstraints()
throws ConstraintException
checkConstraints in interface ASN1TypeConstraintException - if this type is not in the appropriate range of values.
public boolean isType(int tag,
int tagclass)
true if the given tag and tag class matches the
tag and tag class of this instance. This method is used primarily by
decoders and variable types such as ASN1Choice and
ASN1OpenType. It enables decoders to query a
variable type whether a decoded type is accepted.
This method provides a default implementation that matches the given tag
and tag class against the values returned by getTag and
getTagClass respectively.
isType in interface ASN1Typetag - The tag to compare with.tagclass - The tag class to compare with.true if the given tag and tag class matches this
type and false otherwise.
public void encode(Encoder enc)
throws ASN1Exception,
IOException
encoder.encode in interface ASN1Typeenc - The encoder to write this type to.
public void decode(Decoder dec)
throws ASN1Exception,
IOException
Decoder. This type
is initialized with the decoded data. The components of the decoded
collection must match the components of this collection. If they do then
the components are also initialized with the decoded values. Otherwise an
exception is thrown.decode in interface ASN1Typedec - The decoder to read from.public String toString()
toString in class AbstractCollection
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface Externalizableout - -
the stream to write the object toExternalizable
public void readExternal(ObjectInput in)
throws IOException
readExternal in interface Externalizablein - -
the stream to read data from in order to restore the
objectExternalizable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||