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 DERSequence 8 extends ASN1Sequence 9 { 10 13 public DERSequence() 14 { 15 } 16 17 20 public DERSequence( 21 DEREncodable obj) 22 { 23 this.addObject(obj); 24 } 25 26 29 public DERSequence( 30 DEREncodableVector v) 31 { 32 for (int i = 0; i != v.size(); i++) 33 { 34 this.addObject(v.get(i)); 35 } 36 } 37 38 46 void encode( 47 DEROutputStream out) 48 throws IOException 49 { 50 ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 51 DEROutputStream dOut = new DEROutputStream(bOut); 52 Enumeration e = this.getObjects(); 53 54 while (e.hasMoreElements()) 55 { 56 Object obj = e.nextElement(); 57 58 dOut.writeObject(obj); 59 } 60 61 dOut.close(); 62 63 byte[] bytes = bOut.toByteArray(); 64 65 out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes); 66 } 67 } 68 | Popular Tags |