1 package com.lowagie.bc.asn1; 2 3 import java.io.ByteArrayOutputStream; 4 import java.io.IOException; 5 import java.util.Enumeration; 6 7 10 public class DERSet 11 extends ASN1Set 12 { 13 16 public DERSet() 17 { 18 } 19 20 23 public DERSet( 24 DEREncodable obj) 25 { 26 this.addObject(obj); 27 } 28 29 32 public DERSet( 33 DEREncodableVector v) 34 { 35 for (int i = 0; i != v.size(); i++) 36 { 37 this.addObject(v.get(i)); 38 } 39 } 40 41 49 void encode( 50 DEROutputStream out) 51 throws IOException 52 { 53 ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 54 DEROutputStream dOut = new DEROutputStream(bOut); 55 Enumeration e = this.getObjects(); 56 57 while (e.hasMoreElements()) 58 { 59 Object obj = e.nextElement(); 60 61 dOut.writeObject(obj); 62 } 63 64 dOut.close(); 65 66 byte[] bytes = bOut.toByteArray(); 67 68 out.writeEncoded(SET | CONSTRUCTED, bytes); 69 } 70 } 71 | Popular Tags |