Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.jss.asn1
Class SET.Template

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

All Implemented Interfaces:
  ASN1Template

Enclosing class:
  SET

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

SET.Template This class is used for decoding DER-encoded SETs.

Nested Class Summary
`static class` | `SET.Template.Element` An element of a SET template.

Field Summary
`private java.util.Vector` | `elements`

Constructor Summary
`SET.Template()`

Method Summary
`void` | `addElement(ASN1Template t)` Adds a sub-template to the end of this SET template.
`void` | `addElement(ASN1Template t, ASN1Value def)` Adds a sub-template with the given default value to the end of this SET template.
`private void` | `addElement(SET.Template.Element e)`
`void` | `addElement(Tag implicit, ASN1Template t)` Adds a sub-template with the given implicit tag to the end of this SET template.
`void` | `addElement(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.
`void` | `addOptionalElement(ASN1Template t)` Adds an optional sub-template to the end of this SET template.
`void` | `addOptionalElement(Tag implicit, ASN1Template t)` Adds an optional sub-template with the given implicit tag to the end of this SET template.
`ASN1Value` | `decode(java.io.InputStream istream)` Decodes the input stream into a SET value.
`ASN1Value` | `decode(Tag tag, java.io.InputStream istream)` Decodes the input stream into a SET value with the given implicit tag.
`ASN1Value` | `defaultAt(int index)` Returns the default value for the sub-template at the given index.
`private int` | `findElementByTag(Tag tag)` Returns the index in the vector of the type with this tag and class, or -1 if not found.
`private Tag` | `getTag()`
`Tag` | `implicitTagAt(int index)` Returns the implicit tag of the item stored at the given index.
`void` | `insertElementAt(ASN1Template t, ASN1Value def, int index)` Inserts the template with the given default value at the given index.
`void` | `insertElementAt(ASN1Template t, int index)` Inserts the template at the given index.
`private void` | `insertElementAt(SET.Template.Element e, int index)`
`void` | `insertElementAt(Tag implicit, ASN1Template t, ASN1Value def, int index)` Inserts the template with the given implicit tag and given default value at the given index.
`void` | `insertElementAt(Tag implicit, ASN1Template t, int index)` Inserts the template with the given implicit tag at the given index.
`void` | `insertOptionalElementAt(ASN1Template t, int index)` Inserts the optional template at the given index.
`void` | `insertOptionalElementAt(Tag implicit, ASN1Template t, int index)` Inserts the optional template with the given default value at the given index.
`boolean` | `isOptionalAt(int index)` Returns `true` if the sub-template at the given index is optional.
`private boolean` | `isRepeatableAt(int index)`
`void` | `removeAllElements()`
`void` | `removeElementAt(int index)`
`int` | `size()` Returns the number of elements in the SET.
`boolean` | `tagMatch(Tag tag)` Determines whether the given tag satisfies this template.
`ASN1Template` | `templateAt(int index)` Returns the sub-template stored at the given index.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### elements

    private java.util.Vector elements

Constructor Detail

### SET.Template

    public SET.Template()

Method Detail

### addElement

    private void addElement(SET.Template.Element e)

### insertElementAt

    private void insertElementAt(SET.Template.Element e,
                                 int index)

### addElement

    public void addElement(ASN1Template t)

  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() );

### insertElementAt

    public void insertElementAt(ASN1Template t,
                                int index)

  Inserts the template at the given index.

### addElement

    public void addElement(Tag implicit,
                           ASN1Template t)

  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() );

### insertElementAt

    public void insertElementAt(Tag implicit,
                                ASN1Template t,
                                int index)

  Inserts the template with the given implicit tag at the given index.

### addOptionalElement

    public void addOptionalElement(ASN1Template t)

  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() );

### insertOptionalElementAt

    public void insertOptionalElementAt(ASN1Template t,
                                        int index)

  Inserts the optional template at the given index.

### addOptionalElement

    public void addOptionalElement(Tag implicit,
                                   ASN1Template t)

  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() );

### insertOptionalElementAt

    public void insertOptionalElementAt(Tag implicit,
                                        ASN1Template t,
                                        int index)

  Inserts the optional template with the given default value at the given index.

### addElement

    public void addElement(ASN1Template t,
                           ASN1Value def)

  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) );

### insertElementAt

    public void insertElementAt(ASN1Template t,
                                ASN1Value def,
                                int index)

  Inserts the template with the given default value at the given index.

### addElement

    public void addElement(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. 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) );

### insertElementAt

    public void insertElementAt(Tag implicit,
                                ASN1Template t,
                                ASN1Value def,
                                int index)

  Inserts the template with the given implicit tag and given default value at the given index.

### implicitTagAt

    public Tag implicitTagAt(int index)

  Returns the implicit tag of the item stored at the given index. May be NULL if no implicit tag was specified.

### templateAt

    public ASN1Template templateAt(int index)

  Returns the sub-template stored at the given index.

### isOptionalAt

    public boolean isOptionalAt(int index)

  Returns `true` if the sub-template at the given index is optional.

### isRepeatableAt

    private boolean isRepeatableAt(int index)

### defaultAt

    public ASN1Value defaultAt(int index)

  Returns the default value for the sub-template at the given index. May return NULL if no default value was specified.

### size

    public int size()

  Returns the number of elements in the SET.

### removeAllElements

    public void removeAllElements()

### removeElementAt

    public void removeElementAt(int index)

### getTag

    private Tag getTag()

### tagMatch

    public boolean tagMatch(Tag tag)

  Determines whether the given tag satisfies this template.

  Specified by:
    `tagMatch` in interface `ASN1Template`

### decode

    public ASN1Value decode(java.io.InputStream istream)
                     throws java.io.IOException,
                            InvalidBERException

  Decodes the input stream into a SET value.

  Specified by:
    `decode` in interface `ASN1Template`
  Parameters:
    `istream` - Must support marking (markSupported() == true). For example, ByteArrayInputStream and BufferedInputStream support marking, but FileInputStream does not. If your source does not support marking, you can wrap it in a BufferedInputStream.
    `java.io.IOException`
    `InvalidBERException`

### decode

    public ASN1Value decode(Tag tag,
                            java.io.InputStream istream)
                     throws java.io.IOException,
                            InvalidBERException

  Decodes the input stream into a SET value with the given implicit tag.

  Specified by:
    `decode` in interface `ASN1Template`
  Parameters:
    `istream` - Must support marking (markSupported() == true). For example, ByteArrayInputStream and BufferedInputStream support marking, but FileInputStream does not. If your source does not support marking, you can wrap it in a BufferedInputStream.
    `java.io.IOException`
    `InvalidBERException`

### findElementByTag

    private int findElementByTag(Tag tag)

  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

Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD