1 17 18 package org.apache.geronimo.util.asn1; 19 20 import java.io.ByteArrayOutputStream ; 21 import java.io.IOException ; 22 import java.util.Enumeration ; 23 24 28 public class DERConstructedSet 29 extends ASN1Set 30 { 31 public DERConstructedSet() 32 { 33 } 34 35 38 public DERConstructedSet( 39 DEREncodable obj) 40 { 41 this.addObject(obj); 42 } 43 44 47 public DERConstructedSet( 48 DEREncodableVector v) 49 { 50 for (int i = 0; i != v.size(); i++) 51 { 52 this.addObject(v.get(i)); 53 } 54 } 55 56 public void addObject( 57 DEREncodable obj) 58 { 59 super.addObject(obj); 60 } 61 62 public int getSize() 63 { 64 return size(); 65 } 66 67 75 void encode( 76 DEROutputStream out) 77 throws IOException 78 { 79 ByteArrayOutputStream bOut = new ByteArrayOutputStream (); 80 DEROutputStream dOut = new DEROutputStream(bOut); 81 Enumeration e = this.getObjects(); 82 83 while (e.hasMoreElements()) 84 { 85 Object obj = e.nextElement(); 86 87 dOut.writeObject(obj); 88 } 89 90 dOut.close(); 91 92 byte[] bytes = bOut.toByteArray(); 93 94 out.writeEncoded(SET | CONSTRUCTED, bytes); 95 } 96 } 97 | Popular Tags |