1    package org.bouncycastle.asn1;
2    
3    import java.io.*;
4    import java.util.*;
5    
6    public class DERConstructedSequence
7        extends ASN1Sequence
8    {
9        public void addObject(
10           DEREncodable obj)
11       {
12           super.addObject(obj);
13       }
14   
15       public int getSize()
16       {
17           return size();
18       }
19   
20       
28       void encode(
29           DEROutputStream out)
30           throws IOException
31       {
32           ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
33           DEROutputStream         dOut = new DEROutputStream(bOut);
34           Enumeration             e = this.getObjects();
35   
36           while (e.hasMoreElements())
37           {
38               Object    obj = e.nextElement();
39   
40               dOut.writeObject(obj);
41           }
42   
43           dOut.close();
44   
45           byte[]  bytes = bOut.toByteArray();
46   
47           out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
48       }
49   }
50