1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.geronimo.util.asn1;
20
21 import java.io.ByteArrayOutputStream;
22 import java.io.IOException;
23 import java.util.Enumeration;
24
25 /**
26 *
27 * @deprecated use DERSet
28 */
29 public class DERConstructedSet
30 extends ASN1Set
31 {
32 public DERConstructedSet()
33 {
34 }
35
36 /**
37 * @param obj - a single object that makes up the set.
38 */
39 public DERConstructedSet(
40 DEREncodable obj)
41 {
42 this.addObject(obj);
43 }
44
45 /**
46 * @param v - a vector of objects making up the set.
47 */
48 public DERConstructedSet(
49 DEREncodableVector v)
50 {
51 for (int i = 0; i != v.size(); i++)
52 {
53 this.addObject(v.get(i));
54 }
55 }
56
57 public void addObject(
58 DEREncodable obj)
59 {
60 super.addObject(obj);
61 }
62
63 public int getSize()
64 {
65 return size();
66 }
67
68
69
70
71
72
73
74
75
76 void encode(
77 DEROutputStream out)
78 throws IOException
79 {
80 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
81 DEROutputStream dOut = new DEROutputStream(bOut);
82 Enumeration e = this.getObjects();
83
84 while (e.hasMoreElements())
85 {
86 Object obj = e.nextElement();
87
88 dOut.writeObject(obj);
89 }
90
91 dOut.close();
92
93 byte[] bytes = bOut.toByteArray();
94
95 out.writeEncoded(SET | CONSTRUCTED, bytes);
96 }
97 }