Class ASN1TaggedObject
- All Implemented Interfaces:
ASN1Encodable,ASN1TaggedObjectParser,InMemoryRepresentable
- Direct Known Subclasses:
BERTaggedObject,DERTaggedObject,DLTaggedObject
public abstract class ASN1TaggedObject extends ASN1Primitive implements ASN1TaggedObjectParser
-
Constructor Summary
Constructors Constructor Description ASN1TaggedObject(boolean explicit, int tagNo, ASN1Encodable obj)Create a tagged object with the style given by the value of explicit. -
Method Summary
Modifier and Type Method Description static ASN1TaggedObjectgetInstance(Object obj)static ASN1TaggedObjectgetInstance(ASN1TaggedObject obj, boolean explicit)ASN1PrimitivegetLoadedObject()ASN1PrimitivegetObject()return whatever was following the tag.ASN1EncodablegetObjectParser(int tag, boolean isExplicit)Return the object held in this tagged object as a parser assuming it has the type of the passed in tag.intgetTagNo()inthashCode()Returns an integer hash code for this object.booleanisEmpty()booleanisExplicit()return whether or not the object may be explicitly tagged.StringtoString()Returns a string containing a concise, human-readable description of this object.Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
equals, fromByteArray, toASN1PrimitiveMethods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValue, toASN1ObjectMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bouncycastle.asn1.ASN1Encodable
toASN1Primitive
-
Constructor Details
-
ASN1TaggedObject
Create a tagged object with the style given by the value of explicit.If the object implements ASN1Choice the tag style will always be changed to explicit in accordance with the ASN.1 encoding rules.
- Parameters:
explicit- true if the object is explicitly tagged.tagNo- the tag number for this object.obj- the tagged object.
-
-
Method Details
-
getInstance
-
getInstance
-
hashCode
public int hashCode()Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually override both methods or neither method.Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCodemethod if you intend implementing your ownhashCodemethod.- Specified by:
hashCodein classASN1Primitive- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
getTagNo
public int getTagNo()- Specified by:
getTagNoin interfaceASN1TaggedObjectParser
-
isExplicit
public boolean isExplicit()return whether or not the object may be explicitly tagged.Note: if the object has been read from an input stream, the only time you can be sure if isExplicit is returning the true state of affairs is if it returns false. An implicitly tagged object may appear to be explicitly tagged, so you need to understand the context under which the reading was done as well, see getObject below.
-
isEmpty
public boolean isEmpty() -
getObject
return whatever was following the tag.Note: tagged objects are generally context dependent if you're trying to extract a tagged object you should be going via the appropriate getInstance method.
-
getObjectParser
Return the object held in this tagged object as a parser assuming it has the type of the passed in tag. If the object doesn't have a parser associated with it, the base object is returned.- Specified by:
getObjectParserin interfaceASN1TaggedObjectParser
-
getLoadedObject
- Specified by:
getLoadedObjectin interfaceInMemoryRepresentable
-
toString
Description copied from class:ObjectReturns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toStringmethod if you intend implementing your owntoStringmethod.
-