4adefed182dd01bf528a7e5f6b3c9b43c361af9b
[org.ibex.core.git] / src / org / bouncycastle / asn1 / BEROutputStream.java
1 package org.bouncycastle.asn1;
2
3 import java.io.*;
4
5 public class BEROutputStream
6     extends DEROutputStream
7 {
8     public BEROutputStream(
9         OutputStream    os)
10     {
11         super(os);
12     }
13
14     public void writeObject(
15         Object    obj)
16         throws IOException
17     {
18         if (obj == null)
19         {
20             writeNull();
21         }
22         else if (obj instanceof DERObject)
23         {
24             ((DERObject)obj).encode(this);
25         }
26         else if (obj instanceof DEREncodable)
27         {
28             ((DEREncodable)obj).getDERObject().encode(this);
29         }
30         else
31         {
32             throw new IOException("object not BEREncodable");
33         }
34     }
35 }