01: package org.bouncycastle.sasn1;
02:
03: import java.io.ByteArrayInputStream;
04: import java.io.ByteArrayOutputStream;
05: import java.io.IOException;
06: import java.io.InputStream;
07: import java.io.OutputStream;
08:
09: /**
10: * @deprecated use corresponsding classes in org.bouncycastle.asn1.
11: */
12: public class DerObject extends Asn1Object {
13: private byte[] _content;
14:
15: DerObject(int baseTag, int tagNumber, byte[] content) {
16: super (baseTag, tagNumber, null);
17:
18: this ._content = content;
19: }
20:
21: public int getTagNumber() {
22: return _tagNumber;
23: }
24:
25: public InputStream getRawContentStream() {
26: return new ByteArrayInputStream(_content);
27: }
28:
29: public byte[] getEncoded() throws IOException {
30: ByteArrayOutputStream bOut = new ByteArrayOutputStream();
31:
32: this .encode(bOut);
33:
34: return bOut.toByteArray();
35: }
36:
37: void encode(OutputStream out) throws IOException {
38: DerGenerator dGen = new BasicDerGenerator(out);
39:
40: dGen.writeDerEncoded(_baseTag | _tagNumber, _content);
41: }
42:
43: private class BasicDerGenerator extends DerGenerator {
44: protected BasicDerGenerator(OutputStream out) {
45: super (out);
46: }
47:
48: public OutputStream getRawOutputStream() {
49: return _out;
50: }
51: }
52: }
|