KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > bc > asn1 > BERSequence


1 package com.lowagie.bc.asn1;
2
3 import java.io.IOException;
4 import java.util.Enumeration;
5
6 public class BERSequence
7     extends DERSequence
8 {
9     /**
10      * create an empty sequence
11      */

12     public BERSequence()
13     {
14     }
15
16     /**
17      * create a sequence containing one object
18      */

19     public BERSequence(
20         DEREncodable obj)
21     {
22         super(obj);
23     }
24
25     /**
26      * create a sequence containing a vector of objects.
27      */

28     public BERSequence(
29         DEREncodableVector v)
30     {
31         super(v);
32     }
33
34     /*
35      */

36     void encode(
37         DEROutputStream out)
38         throws IOException
39     {
40         if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
41         {
42             out.write(SEQUENCE | CONSTRUCTED);
43             out.write(0x80);
44             
45             Enumeration e = getObjects();
46             while (e.hasMoreElements())
47             {
48                 out.writeObject(e.nextElement());
49             }
50         
51             out.write(0x00);
52             out.write(0x00);
53         }
54         else
55         {
56             super.encode(out);
57         }
58     }
59 }
60
Popular Tags