001 package org.apache.commons.ssl.asn1;
002
003 import java.io.IOException;
004 import java.io.OutputStream;
005
006 public class ASN1OutputStream
007 extends DEROutputStream {
008 public ASN1OutputStream(
009 OutputStream os) {
010 super(os);
011 }
012
013 public void writeObject(
014 Object obj)
015 throws IOException {
016 if (obj == null) {
017 writeNull();
018 } else if (obj instanceof DERObject) {
019 ((DERObject) obj).encode(this);
020 } else if (obj instanceof DEREncodable) {
021 ((DEREncodable) obj).getDERObject().encode(this);
022 } else {
023 throw new IOException("object not ASN1Encodable");
024 }
025 }
026 }