Logo Search packages:      
Sourcecode: bouncycastle version File versions  Download package

BERSet.java
package org.bouncycastle.asn1;

import java.io.IOException;
import java.util.Enumeration;

00006 public class BERSet
    extends DERSet
{
    /**
     * create an empty sequence
     */
00012     public BERSet()
    {
    }

    /**
     * create a set containing one object
     */
00019     public BERSet(
        DEREncodable    obj)
    {
        super(obj);
    }

    /**
     * @param v - a vector of objects making up the set.
     */
00028     public BERSet(
        ASN1EncodableVector   v)
    {
        super(v, false);
    }

    /**
     * @param v - a vector of objects making up the set.
     */
00037     BERSet(
        ASN1EncodableVector  v,
        boolean              needsSorting)
    {
        super(v, needsSorting);
    }

    /*
     */
    void encode(
        DEROutputStream out)
        throws IOException
    {
        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
        {
            out.write(SET | CONSTRUCTED);
            out.write(0x80);
            
            Enumeration e = getObjects();
            while (e.hasMoreElements())
            {
                out.writeObject(e.nextElement());
            }
        
            out.write(0x00);
            out.write(0x00);
        }
        else
        {
            super.encode(out);
        }
    }
}

Generated by  Doxygen 1.6.0   Back to index