1    package org.bouncycastle.asn1;
2    
3    import java.io.*;
4    import java.util.*;
5    
6    public class BERConstructedSequence
7        extends DERConstructedSequence
8    {
9        /*
10        */
11       void encode(
12           DEROutputStream out)
13           throws IOException
14       {
15           if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
16           {
17               out.write(SEQUENCE | CONSTRUCTED);
18               out.write(0x80);
19               
20               Enumeration e = getObjects();
21               while (e.hasMoreElements())
22               {
23                   out.writeObject(e.nextElement());
24               }
25           
26               out.write(0x00);
27               out.write(0x00);
28           }
29           else
30           {
31               super.encode(out);
32           }
33       }
34   }
35