001package org.apache.commons.ssl.asn1;
002
003import java.io.IOException;
004import java.io.OutputStream;
005
006public class BEROutputStream
007    extends DEROutputStream {
008    public BEROutputStream(
009        OutputStream os) {
010        super(os);
011    }
012
013    public void writeObject(
014        Object obj)
015        throws IOException {
016        if (obj == null) {
017            writeNull();
018        } else if (obj instanceof DERObject) {
019            ((DERObject) obj).encode(this);
020        } else if (obj instanceof DEREncodable) {
021            ((DEREncodable) obj).getDERObject().encode(this);
022        } else {
023            throw new IOException("object not BEREncodable");
024        }
025    }
026}