1package org.bouncycastle.asn1;
2
3import java.io.IOException;
4import java.io.OutputStream;
5
6/**
7 * Stream that outputs encoding based on definite length.
8 */
9public class DLOutputStream
10    extends ASN1OutputStream
11{
12    public DLOutputStream(
13        OutputStream os)
14    {
15        super(os);
16    }
17
18    public void writeObject(
19        ASN1Encodable obj)
20        throws IOException
21    {
22        if (obj != null)
23        {
24            obj.toASN1Primitive().toDLObject().encode(this);
25        }
26        else
27        {
28            throw new IOException("null object detected");
29        }
30    }
31}
32