1 package org.bouncycastle.asn1;
3 import java.io.FilterOutputStream;
5 import java.io.OutputStream;
6 import java.io.IOException;
7 import java.io.EOFException;
9 public class DEROutputStream
10 extends FilterOutputStream implements DERTags
12 public DEROutputStream(
18 private void writeLength(
27 while ((val >>>= 8) != 0)
32 write((byte)(size | 0x80));
34 for (int i = (size - 1) * 8; i >= 0; i -= 8)
36 write((byte)(length >> i));
51 writeLength(bytes.length);
55 protected void writeNull()
62 public void writeObject(
70 else if (obj instanceof DERObject)
72 ((DERObject)obj).encode(this);
74 else if (obj instanceof DEREncodable)
76 ((DEREncodable)obj).getDERObject().encode(this);
80 throw new IOException("object not DEREncodable");