01: package org.bouncycastle.asn1;
02:
03: import java.io.IOException;
04:
05: public abstract class ASN1Object extends DERObject {
06: /**
07: * Create a base ASN.1 object from a byte stream.
08: *
09: * @param data the byte stream to parse.
10: * @return the base ASN.1 object represented by the byte stream.
11: * @exception IOException if there is a problem parsing the data.
12: */
13: public static ASN1Object fromByteArray(byte[] data)
14: throws IOException {
15: ASN1InputStream aIn = new ASN1InputStream(data);
16:
17: return (ASN1Object) aIn.readObject();
18: }
19:
20: public final boolean equals(Object o) {
21: if (this == o) {
22: return true;
23: }
24:
25: return (o instanceof DEREncodable)
26: && asn1Equals(((DEREncodable) o).getDERObject());
27: }
28:
29: public abstract int hashCode();
30:
31: abstract void encode(DEROutputStream out) throws IOException;
32:
33: abstract boolean asn1Equals(DERObject o);
34: }
|