1package org.bouncycastle.asn1; 2 3import java.io.IOException; 4import java.io.OutputStream; 5 6/** 7 * Stream that outputs encoding based on distinguished encoding rules. 8 */ 9public class DEROutputStream 10 extends ASN1OutputStream 11{ 12 public DEROutputStream( 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().toDERObject().encode(this); 25 } 26 else 27 { 28 throw new IOException("null object detected"); 29 } 30 } 31 32 ASN1OutputStream getDERSubStream() 33 { 34 return this; 35 } 36 37 ASN1OutputStream getDLSubStream() 38 { 39 return this; 40 } 41} 42