1 package org.bouncycastle.asn1;
3 import java.io.FilterOutputStream;
5 import java.io.OutputStream;
6 import java.io.IOException;
8 public class DEROutputStream
9 extends FilterOutputStream implements DERTags
11 public DEROutputStream(
17 private void writeLength(
26 while ((val >>>= 8) != 0)
31 write((byte)(size | 0x80));
33 for (int i = (size - 1) * 8; i >= 0; i -= 8)
35 write((byte)(length >> i));
50 writeLength(bytes.length);
54 protected void writeNull()
61 public void writeObject(
69 else if (obj instanceof DERObject)
71 ((DERObject)obj).encode(this);
73 else if (obj instanceof DEREncodable)
75 ((DEREncodable)obj).getDERObject().encode(this);
79 throw new IOException("object not DEREncodable");