1package org.bouncycastle.asn1; 2 3import java.io.IOException; 4import java.io.OutputStream; 5 6public 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 ASN1Primitive) 24 { 25 ((ASN1Primitive)obj).encode(this); 26 } 27 else if (obj instanceof ASN1Encodable) 28 { 29 ((ASN1Encodable)obj).toASN1Primitive().encode(this); 30 } 31 else 32 { 33 throw new IOException("object not BEREncodable"); 34 } 35 } 36} 37