01: package org.bouncycastle.asn1;
02:
03: import java.io.IOException;
04: import java.util.Enumeration;
05:
06: public class BERSequence extends DERSequence {
07: /**
08: * create an empty sequence
09: */
10: public BERSequence() {
11: }
12:
13: /**
14: * create a sequence containing one object
15: */
16: public BERSequence(DEREncodable obj) {
17: super (obj);
18: }
19:
20: /**
21: * create a sequence containing a vector of objects.
22: */
23: public BERSequence(DEREncodableVector v) {
24: super (v);
25: }
26:
27: /*
28: */
29: void encode(DEROutputStream out) throws IOException {
30: if (out instanceof ASN1OutputStream
31: || out instanceof BEROutputStream) {
32: out.write(SEQUENCE | CONSTRUCTED);
33: out.write(0x80);
34:
35: Enumeration e = getObjects();
36: while (e.hasMoreElements()) {
37: out.writeObject(e.nextElement());
38: }
39:
40: out.write(0x00);
41: out.write(0x00);
42: } else {
43: super.encode(out);
44: }
45: }
46: }
|