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

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

All Implemented Interfaces:
  ASN1Value

Direct Known Subclasses:
  SEQUENCE

public class SET
extends java.lang.Object
implements ASN1Value

An ASN.1 SET, which is an unordered collection of ASN.1 values. It has an interface like a Java Vector, but the ordering is arbitrary. Null entries may be added; they will be skipped when encoding.

Nested Class Summary
`(package private) static class` | `SET.Element` An element of a SET
`static class` | `SET.OF_Template` A Template for decoding SET OF values.
`static class` | `SET.Template` SET.Template This class is used for decoding DER-encoded SETs.

Field Summary
`protected java.util.Vector` | `elements`
`protected static Form` | `FORM`
`static Tag` | `TAG`

Constructor Summary
`SET()`

Method Summary
`void` | `addElement(ASN1Value v)` Adds an element to this SET.
`private void` | `addElement(SET.Element e)`
`void` | `addElement(Tag implicitTag, ASN1Value v)` Adds an element to this SET with the given implicit tag.
`void` | `BERencode(Tag implicitTag, java.io.OutputStream ostream)` Encodes this SET without re-ordering it.
`private static int` | `compare(byte[] left, byte[] right)`
`ASN1Value` | `elementAt(int index)` Returns the element at the given index in the SET.
`ASN1Value` | `elementWithTag(Tag tag)` Returns the element with the given Tag, or null if no element exists with the given tag.
`void` | `encode(java.io.OutputStream ostream)` Writes the DER encoding to the given output stream.
`void` | `encode(Tag implicitTag, java.io.OutputStream ostream)` Writes the DER encoding to the given output stream, using the given implicit tag.
`Tag` | `getTag()` Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
`void` | `insertElementAt(ASN1Value v, int index)` Inserts an element at the given index.
`private void` | `insertElementAt(SET.Element e, int index)`
`void` | `insertElementAt(Tag implicitTag, ASN1Value v, int index)` Inserts an element with the given implicit tag at the given index.
`private static void` | `insertInOrder(java.util.Vector encs, byte[] enc)`
`private static void` | `insertInOrder(java.util.Vector encs, byte[] enc, java.util.Vector tags, int tag)`
`static void` | `main(java.lang.String[] args)`
`void` | `removeAllElements()` Removes all elements from this SET.
`void` | `removeElementAt(int index)` Removes the element from the specified index.
`int` | `size()` Returns the number of elements in this SET.
`Tag` | `tagAt(int index)` Returns the tag of the element at the given index.

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

Field Detail

### TAG

    public static final Tag TAG

### FORM

    protected static final Form FORM

### elements

    protected java.util.Vector elements

Constructor Detail

### SET

    public SET()

Method Detail

### getTag

    public Tag getTag()

  Description copied from interface: `ASN1Value`
  Returns the base tag for this type, not counting any tags that may be imposed on it by its context.

  Specified by:
    `getTag` in interface `ASN1Value`

### addElement

    private void addElement(SET.Element e)

### insertElementAt

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

### addElement

    public void addElement(ASN1Value v)

  Adds an element to this SET.

### addElement

    public void addElement(Tag implicitTag,
                           ASN1Value v)

  Adds an element to this SET with the given implicit tag. For example, if the ASN.1 were:

        MyType ::= SET {
            item        [0] IMPLICIT INTEGER,
            ... }

  then the "item" element could be added (with a sample value of 45) to the SET with:

       myTypeInstance.addElement( new Tag(0), new INTEGER(45) );

### insertElementAt

    public void insertElementAt(ASN1Value v,
                                int index)

  Inserts an element at the given index.

### insertElementAt

    public void insertElementAt(Tag implicitTag,
                                ASN1Value v,
                                int index)

  Inserts an element with the given implicit tag at the given index.

### elementAt

    public ASN1Value elementAt(int index)

  Returns the element at the given index in the SET.

### tagAt

    public Tag tagAt(int index)

  Returns the tag of the element at the given index. If the element has an implicit tag, that is returned. Otherwise, the tag of the underlying type is returned.

### elementWithTag

    public ASN1Value elementWithTag(Tag tag)

  Returns the element with the given Tag, or null if no element exists with the given tag.

### size

    public int size()

  Returns the number of elements in this SET.

### removeAllElements

    public void removeAllElements()

  Removes all elements from this SET.

### removeElementAt

    public void removeElementAt(int index)

  Removes the element from the specified index.

### encode

    public void encode(java.io.OutputStream ostream)
                throws java.io.IOException

  Writes the DER encoding to the given output stream.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### encode

    public void encode(Tag implicitTag,
                       java.io.OutputStream ostream)
                throws java.io.IOException

  Writes the DER encoding to the given output stream, using the given implicit tag. To satisfy DER encoding rules, the elements will be re-ordered either by tag or lexicographically.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### BERencode

    public void BERencode(Tag implicitTag,
                          java.io.OutputStream ostream)
                   throws java.io.IOException

  Encodes this SET without re-ordering it. This may violate DER, but it is within BER.

    `java.io.IOException`

### insertInOrder

    private static void insertInOrder(java.util.Vector encs,
                                      byte[] enc)

### insertInOrder

    private static void insertInOrder(java.util.Vector encs,
                                      byte[] enc,
                                      java.util.Vector tags,
                                      int tag)

### compare

    private static int compare(byte[] left,
                               byte[] right)

### main

    public static void main(java.lang.String[] args)

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