1 package org.bouncycastle.asn1;
2
3 import java.io.*;
4 import java.util.*;
5
6 public class DERConstructedSet
7 extends ASN1Set
8 {
9 public DERConstructedSet()
10 {
11 }
12
13
16 public DERConstructedSet(
17 DEREncodable obj)
18 {
19 this.addObject(obj);
20 }
21
22
25 public DERConstructedSet(
26 DEREncodableVector v)
27 {
28 for (int i = 0; i != v.size(); i++)
29 {
30 this.addObject(v.get(i));
31 }
32 }
33
34 public void addObject(
35 DEREncodable obj)
36 {
37 super.addObject(obj);
38 }
39
40 public int getSize()
41 {
42 return size();
43 }
44
45
53 void encode(
54 DEROutputStream out)
55 throws IOException
56 {
57 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
58 DEROutputStream dOut = new DEROutputStream(bOut);
59 Enumeration e = this.getObjects();
60
61 while (e.hasMoreElements())
62 {
63 Object obj = e.nextElement();
64
65 dOut.writeObject(obj);
66 }
67
68 dOut.close();
69
70 byte[] bytes = bOut.toByteArray();
71
72 out.writeEncoded(SET | CONSTRUCTED, bytes);
73 }
74 }
75