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