Class ASN1Primitive
java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.ASN1Primitive
- All Implemented Interfaces:
ASN1Encodable, Encodable
- Direct Known Subclasses:
ASN1Absent, ASN1BitString, ASN1BMPString, ASN1Boolean, ASN1Enumerated, ASN1External, ASN1GeneralizedTime, ASN1GeneralString, ASN1GraphicString, ASN1IA5String, ASN1Integer, ASN1Null, ASN1NumericString, ASN1ObjectDescriptor, ASN1ObjectIdentifier, ASN1OctetString, ASN1PrintableString, ASN1RelativeOID, ASN1Sequence, ASN1Set, ASN1T61String, ASN1TaggedObject, ASN1UniversalString, ASN1UTCTime, ASN1UTF8String, ASN1VideotexString, ASN1VisibleString
Base class for ASN.1 primitive objects. These are the actual objects used to generate byte encodings.
-
Method Summary
Modifier and TypeMethodDescriptionvoidencodeTo(OutputStream output) voidencodeTo(OutputStream output, String encoding) final booleanfinal booleanequals(ASN1Encodable other) final booleanequals(ASN1Primitive other) static ASN1PrimitivefromByteArray(byte[] data) Parse an ASN.1 (BER) encoding from a byte array.static ASN1PrimitivefromStream(InputStream input) Parse the first ASN.1 (BER) encoding from anInputStream.The stream is not closed by this method and may contain further data beyond the first ASN.1 encoding.abstract inthashCode()final ASN1PrimitiveMethod providing a primitive representation of this object suitable for encoding.Methods inherited from class ASN1Object
getEncoded, getEncoded, hasEncodedTagValue
-
Method Details
-
encodeTo
- Overrides:
encodeToin classASN1Object- Throws:
IOException
-
encodeTo
- Overrides:
encodeToin classASN1Object- Throws:
IOException
-
fromByteArray
Parse an ASN.1 (BER) encoding from a byte array. Checks there are no extra bytes following the encoding.- Parameters:
data- the byte array to parse.- Returns:
- the base ASN.1 object parsed from the byte array.
- Throws:
IOException- if there is a problem parsing the data, or parsing did not exhaust the available data.
-
fromStream
Parse the first ASN.1 (BER) encoding from anInputStream.The stream is not closed by this method and may contain further data beyond the first ASN.1 encoding.- Parameters:
data- the stream to parse.- Returns:
- the base ASN.1 object parsed from the stream.
- Throws:
IOException- if there is a problem parsing the data.
-
equals
- Overrides:
equalsin classASN1Object
-
equals
-
equals
-
toASN1Primitive
Description copied from class:ASN1ObjectMethod providing a primitive representation of this object suitable for encoding.- Specified by:
toASN1Primitivein interfaceASN1Encodable- Specified by:
toASN1Primitivein classASN1Object- Returns:
- a primitive representation of this object.
-
hashCode
public abstract int hashCode()- Overrides:
hashCodein classASN1Object
-