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 public class DERSequence 25 extends ASN1Sequence 26 { 27 30 public DERSequence() 31 { 32 } 33 34 37 public DERSequence( 38 DEREncodable obj) 39 { 40 this.addObject(obj); 41 } 42 43 46 public DERSequence( 47 DEREncodableVector v) 48 { 49 for (int i = 0; i != v.size(); i++) 50 { 51 this.addObject(v.get(i)); 52 } 53 } 54 55 58 public DERSequence( 59 ASN1Encodable[] a) 60 { 61 for (int i = 0; i != a.length; i++) 62 { 63 this.addObject(a[i]); 64 } 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(SEQUENCE | CONSTRUCTED, bytes); 95 } 96 } 97 | Popular Tags |