001 package org.apache.commons.ssl.asn1; 002 003 import java.io.IOException; 004 import java.util.Enumeration; 005 006 public class BERSequence 007 extends DERSequence { 008 /** create an empty sequence */ 009 public BERSequence() { 010 } 011 012 /** create a sequence containing one object */ 013 public BERSequence( 014 DEREncodable obj) { 015 super(obj); 016 } 017 018 /** create a sequence containing a vector of objects. */ 019 public BERSequence( 020 DEREncodableVector v) { 021 super(v); 022 } 023 024 /* 025 */ 026 void encode( 027 DEROutputStream out) 028 throws IOException { 029 if (out instanceof ASN1OutputStream || out instanceof BEROutputStream) { 030 out.write(SEQUENCE | CONSTRUCTED); 031 out.write(0x80); 032 033 Enumeration e = getObjects(); 034 while (e.hasMoreElements()) { 035 out.writeObject(e.nextElement()); 036 } 037 038 out.write(0x00); 039 out.write(0x00); 040 } else { 041 super.encode(out); 042 } 043 } 044 }