    001package org.apache.commons.ssl.asn1;
    002
    003import java.io.ByteArrayOutputStream;
    004import java.io.IOException;
    005import java.io.OutputStream;
    006
    007public class DERSequenceGenerator
    008    extends DERGenerator {
    009    private final ByteArrayOutputStream _bOut = new ByteArrayOutputStream();
    010
    011    public DERSequenceGenerator(
    012        OutputStream out)
    013        throws IOException {
    014        super(out);
    015    }
    016
    017    public DERSequenceGenerator(
    018        OutputStream out,
    019        int tagNo,
    020        boolean isExplicit)
    021        throws IOException {
    022        super(out, tagNo, isExplicit);
    023    }
    024
    025    public void addObject(
    026        DEREncodable object)
    027        throws IOException {
    028        object.getDERObject().encode(new DEROutputStream(_bOut));
    029    }
    030
    031    public OutputStream getRawOutputStream() {
    032        return _bOut;
    033    }
    034
    035    public void close()
    036        throws IOException {
    037        writeDEREncoded(DERTags.CONSTRUCTED | DERTags.SEQUENCE, _bOut.toByteArray());
    038    }
    039}