01: package org.bouncycastle.asn1;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: public class ASN1OutputStream extends DEROutputStream {
07: public ASN1OutputStream(OutputStream os) {
08: super (os);
09: }
10:
11: public void writeObject(Object obj) throws IOException {
12: if (obj == null) {
13: writeNull();
14: } else if (obj instanceof DERObject) {
15: ((DERObject) obj).encode(this );
16: } else if (obj instanceof DEREncodable) {
17: ((DEREncodable) obj).getDERObject().encode(this );
18: } else {
19: throw new IOException("object not ASN1Encodable");
20: }
21: }
22: }
|