Bouncy Castle Cryptography Library 1.85

org.bouncycastle.asn1
Class ASN1Primitive

java.lang.Object
  extended byorg.bouncycastle.asn1.ASN1Object
      extended byorg.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

public abstract class ASN1Primitive
extends ASN1Object

Base class for ASN.1 primitive objects. These are the actual objects used to generate byte encodings.


Method Summary
 void encodeTo(java.io.OutputStream output)
           
 void encodeTo(java.io.OutputStream output, java.lang.String encoding)
           
 boolean equals(ASN1Encodable other)
           
 boolean equals(ASN1Primitive other)
           
 boolean equals(java.lang.Object o)
           
static ASN1Primitive fromByteArray(byte[] data)
          Parse an ASN.1 (BER) encoding from a byte array.
static ASN1Primitive fromStream(java.io.InputStream input)
          Parse the first ASN.1 (BER) encoding from an InputStream.The stream is not closed by this method and may contain further data beyond the first ASN.1 encoding.
abstract  int hashCode()
           
 ASN1Primitive toASN1Primitive()
          Method providing a primitive representation of this object suitable for encoding.
 
Methods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeTo

public void encodeTo(java.io.OutputStream output)
              throws java.io.IOException
Overrides:
encodeTo in class ASN1Object
Throws:
java.io.IOException

encodeTo

public void encodeTo(java.io.OutputStream output,
                     java.lang.String encoding)
              throws java.io.IOException
Overrides:
encodeTo in class ASN1Object
Throws:
java.io.IOException

fromByteArray

public static ASN1Primitive fromByteArray(byte[] data)
                                   throws java.io.IOException
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:
java.io.IOException - if there is a problem parsing the data, or parsing did not exhaust the available data.

fromStream

public static ASN1Primitive fromStream(java.io.InputStream input)
                                throws java.io.IOException
Parse the first ASN.1 (BER) encoding from an InputStream.The stream is not closed by this method and may contain further data beyond the first ASN.1 encoding.

Returns:
the base ASN.1 object parsed from the stream.
Throws:
java.io.IOException - if there is a problem parsing the data.

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class ASN1Object

equals

public final boolean equals(ASN1Encodable other)

equals

public final boolean equals(ASN1Primitive other)

toASN1Primitive

public final ASN1Primitive toASN1Primitive()
Description copied from class: ASN1Object
Method providing a primitive representation of this object suitable for encoding.

Specified by:
toASN1Primitive in interface ASN1Encodable
Specified by:
toASN1Primitive in class ASN1Object
Returns:
a primitive representation of this object.

hashCode

public abstract int hashCode()
Overrides:
hashCode in class ASN1Object

Bouncy Castle Cryptography Library 1.85