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