JSS 3.1

org.mozilla.jss.asn1
Class CHOICE.Template

java.lang.Object
  |
  +--org.mozilla.jss.asn1.CHOICE.Template

public static class CHOICE.Template
extends java.lang.Object
implements ASN1Template

A Template for decoding ASN.1 CHOICEs


Inner Class Summary
private static class CHOICE.Template.Element
          An element in a CHOICE template, consisting of a nested template and, optionally, an implicit tag for that template.
 
Field Summary
private  java.util.Vector templates
           
 
Constructor Summary
CHOICE.Template()
          Creates an empty CHOICE template
 
Method Summary
 void addElement(ASN1Template template)
          Adds a new sub-template to this CHOICE template with no implicit tag.
 void addElement(Tag implicitTag, ASN1Template template)
          Adds a new sub-template to this CHOICE template with an implicit tag.
 ASN1Value decode(java.io.InputStream istream)
           
 ASN1Value decode(Tag implicitTag, java.io.InputStream istream)
          Decodes a CHOICE.
 ASN1Template elementAt(int index)
          Retrieves the element at the specified index.
 Tag implicitTagAt(int index)
          Retrieves the implicit tag of the element at the specified index.
 void removeAllElements()
          Empties this CHOICE template.
 void removeElementAt(int index)
          Removes the element at the specified index.
 int size()
          Returns the number of elements in this CHOICE template.
 boolean tagMatch(Tag t)
          Determines whether the given tag will satisfy this template.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

templates

private java.util.Vector templates
Constructor Detail

CHOICE.Template

public CHOICE.Template()
Creates an empty CHOICE template
Method Detail

addElement

public void addElement(ASN1Template template)
Adds a new sub-template to this CHOICE template with no implicit tag.

addElement

public void addElement(Tag implicitTag,
                       ASN1Template template)
Adds a new sub-template to this CHOICE template with an implicit tag.

size

public int size()
Returns the number of elements in this CHOICE template.

elementAt

public ASN1Template elementAt(int index)
Retrieves the element at the specified index.

implicitTagAt

public Tag implicitTagAt(int index)
Retrieves the implicit tag of the element at the specified index. Returns null if there is no implicit tag for this element.

removeAllElements

public void removeAllElements()
Empties this CHOICE template.

removeElementAt

public void removeElementAt(int index)
Removes the element at the specified index.

tagMatch

public boolean tagMatch(Tag t)
Determines whether the given tag will satisfy this template. For a CHOICE, this is true if the tag satisfies any sub-template.
Specified by:
tagMatch in interface ASN1Template

decode

public ASN1Value decode(java.io.InputStream istream)
                 throws java.io.IOException,
                        InvalidBERException
Specified by:
decode in interface ASN1Template

decode

public ASN1Value decode(Tag implicitTag,
                        java.io.InputStream istream)
                 throws java.io.IOException,
                        InvalidBERException
Decodes a CHOICE.
Specified by:
decode in interface ASN1Template
Parameters:
implicitTag - This parameter is ignored. A choice cannot have an implicit tag.

JSS 3.1