001package org.apache.commons.ssl.org.bouncycastle.asn1; 002 003import java.io.IOException; 004import java.io.OutputStream; 005 006/** 007 * Stream that outputs encoding based on distinguished encoding rules. 008 */ 009public class DEROutputStream 010 extends ASN1OutputStream 011{ 012 public DEROutputStream( 013 OutputStream os) 014 { 015 super(os); 016 } 017 018 public void writeObject( 019 ASN1Encodable obj) 020 throws IOException 021 { 022 if (obj != null) 023 { 024 obj.toASN1Primitive().toDERObject().encode(this); 025 } 026 else 027 { 028 throw new IOException("null object detected"); 029 } 030 } 031 032 ASN1OutputStream getDERSubStream() 033 { 034 return this; 035 } 036 037 ASN1OutputStream getDLSubStream() 038 { 039 return this; 040 } 041}