Package org.mozilla.jss.asn1
Class SET.Template
java.lang.Object
org.mozilla.jss.asn1.SET.Template
- All Implemented Interfaces:
ASN1Template
- Enclosing class:
- SET
SET.Template
This class is used for decoding DER-encoded SETs.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a sub-template to the end of this SET template.voidaddElement(ASN1Template t, ASN1Value def) Adds a sub-template with the given default value to the end of this SET template.private voidvoidaddElement(Tag implicit, ASN1Template t) Adds a sub-template with the given implicit tag to the end of this SET template.voidaddElement(Tag implicit, ASN1Template t, ASN1Value def) Adds a sub-template with the given default value and implicit tag to the end of this SET template.voidAdds an optional sub-template to the end of this SET template.voidaddOptionalElement(Tag implicit, ASN1Template t) Adds an optional sub-template with the given implicit tag to the end of this SET template.decode(InputStream istream) Decodes the input stream into a SET value.decode(Tag tag, InputStream istream) Decodes the input stream into a SET value with the given implicit tag.defaultAt(int index) Returns the default value for the sub-template at the given index.private intfindElementByTag(Tag tag) Returns the index in the vector of the type with this tag and class, or -1 if not found.private TaggetTag()implicitTagAt(int index) Returns the implicit tag of the item stored at the given index.voidinsertElementAt(ASN1Template t, int index) Inserts the template at the given index.voidinsertElementAt(ASN1Template t, ASN1Value def, int index) Inserts the template with the given default value at the given index.private voidinsertElementAt(SET.Template.Element e, int index) voidinsertElementAt(Tag implicit, ASN1Template t, int index) Inserts the template with the given implicit tag at the given index.voidinsertElementAt(Tag implicit, ASN1Template t, ASN1Value def, int index) Inserts the template with the given implicit tag and given default value at the given index.voidinsertOptionalElementAt(ASN1Template t, int index) Inserts the optional template at the given index.voidinsertOptionalElementAt(Tag implicit, ASN1Template t, int index) Inserts the optional template with the given default value at the given index.booleanisOptionalAt(int index) Returnstrueif the sub-template at the given index is optional.private booleanisRepeatableAt(int index) voidvoidremoveElementAt(int index) intsize()booleanDetermines whether the given tag satisfies this template.templateAt(int index) Returns the sub-template stored at the given index.
-
Field Details
-
elements
-
-
Constructor Details
-
Template
public Template()
-
-
Method Details
-
addElement
-
insertElementAt
-
addElement
Adds a sub-template to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item SubType, ... }the "item" element would be added to the MySet template with:mySet.addElement(new SubType.Template());
- Parameters:
t- Sub-template.
-
insertElementAt
Inserts the template at the given index.- Parameters:
t- Sub-template.index- Index.
-
addElement
Adds a sub-template with the given implicit tag to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item [0] IMPLICIT SubType, ... }the "item" element would be added to the MySet template with:mySet.addElement(new Tag(0), new SubType.Template());
- Parameters:
implicit- Implicit tag.t- Sub-template.
-
insertElementAt
Inserts the template with the given implicit tag at the given index.- Parameters:
implicit- Implicit tag.t- Sub-template.index- Index.
-
addOptionalElement
Adds an optional sub-template to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item SubType OPTIONAL, ... }the "item" element would be added to the MySet template with:mySet.addOptionalElement(new SubType.Template());
- Parameters:
t- Optional sub-template.
-
insertOptionalElementAt
Inserts the optional template at the given index.- Parameters:
t- Optional sub-template.index- Index.
-
addOptionalElement
Adds an optional sub-template with the given implicit tag to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item [0] IMPLICIT SubType OPTIONAL, ... }the "item" element would be added to the MySet template with:mySet.addOptionalElement(new Tag(0), new SubType.Template());
- Parameters:
implicit- Implicit tag.t- Optional sub-template.
-
insertOptionalElementAt
Inserts the optional template with the given default value at the given index.- Parameters:
implicit- Implicit tag.t- Optional sub-template.index- Index.
-
addElement
Adds a sub-template with the given default value to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item INTEGER DEFAULT (5), ... }the "item" element would be added to the MySet template with:mySet.addElement(new SubType.Template(), new INTEGER(5));
- Parameters:
t- Sub-template.def- Default value.
-
insertElementAt
Inserts the template with the given default value at the given index.- Parameters:
t- Sub-template.def- Default value.index- Index.
-
addElement
Adds a sub-template with the given default value and implicit tag to the end of this SET template. For example, if the ASN.1 included:MySet ::= SET { item [0] IMPLICIT INTEGER DEFAULT (5), ... }the "item" element would be added to the MySet template with:mySet.addElement(new Tag(0), new SubType.Template(), new INTEGER(5));
- Parameters:
implicit- Implicit tag.t- Sub-template.def- Default value.
-
insertElementAt
Inserts the template with the given implicit tag and given default value at the given index.- Parameters:
implicit- Implicit tag.t- Sub-template.def- Default value.index- Index.
-
implicitTagAt
Returns the implicit tag of the item stored at the given index. May be NULL if no implicit tag was specified.- Parameters:
index- Index.- Returns:
- Implicit tag.
-
templateAt
Returns the sub-template stored at the given index.- Parameters:
index- Index.- Returns:
- Sub-template.
-
isOptionalAt
public boolean isOptionalAt(int index) Returnstrueif the sub-template at the given index is optional.- Parameters:
index- Index.- Returns:
- True if sub-template is optional.
-
isRepeatableAt
private boolean isRepeatableAt(int index) -
defaultAt
Returns the default value for the sub-template at the given index. May return NULL if no default value was specified.- Parameters:
index- Index.- Returns:
- Default value.
-
size
public int size()- Returns:
- The number of elements in the SET.
-
removeAllElements
public void removeAllElements() -
removeElementAt
public void removeElementAt(int index) -
getTag
-
tagMatch
Determines whether the given tag satisfies this template.- Specified by:
tagMatchin interfaceASN1Template- Parameters:
tag- Tag.- Returns:
- True if tag satisfies this template.
-
decode
Decodes the input stream into a SET value.- Specified by:
decodein interfaceASN1Template- Parameters:
istream- Input stream.- Returns:
- Decoded SET value.
- Throws:
IOException- If other error occurred.InvalidBERException- If there is an invalid BER encoding.
-
decode
Decodes the input stream into a SET value with the given implicit tag.- Specified by:
decodein interfaceASN1Template- Parameters:
tag- Implicit tag.istream- Input stream.- Returns:
- Decoded SET value.
- Throws:
IOException- If other error occurred.InvalidBERException- If there is an invalid BER encoding.
-
findElementByTag
Returns the index in the vector of the type with this tag and class, or -1 if not found. lame linear search - but we're dealing with small numbers of elements, so it's probably not worth it to use a hashtable- Parameters:
tag- Tag.
-