001package org.apache.commons.ssl.org.bouncycastle.asn1;
002
003import java.io.IOException;
004import java.io.OutputStream;
005
006/**
007 * Stream that outputs encoding based on definite length.
008 */
009public class DLOutputStream
010    extends ASN1OutputStream
011{
012    public DLOutputStream(
013        OutputStream os)
014    {
015        super(os);
016    }
017
018    public void writeObject(
019        ASN1Encodable obj)
020        throws IOException
021    {
022        if (obj != null)
023        {
024            obj.toASN1Primitive().toDLObject().encode(this);
025        }
026        else
027        {
028            throw new IOException("null object detected");
029        }
030    }
031}