Package org.forgerock.opendj.io
Class Asn1Tag
- java.lang.Object
-
- org.forgerock.opendj.io.Asn1Tag
-
public final class Asn1Tag extends Object
Provides methods for building and analyzing ASN.1 tag bytes.Examples of usage:
- Building a Universal, primitive with number 3 tag:
Asn1Tag.universal().number(3);
will return 0x03. - Building an application, constructed with number 9 tag:
Asn1Tag.application().constructed().number(9);
will return 0x69.
- Building a Universal, primitive with number 3 tag:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAsn1Tag.ClassThe Asn1 tag classes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Asn1Tagapplication()Returns a primitive ASN.1 tag with the application tag class.Asn1Tagconstructed()Changes this ASN.1 tag from primitive to constructed.static Asn1TagcontextSpecific()Returns a primitive ASN.1 tag with the context-specific tag class.Asn1Tag.ClassgetClassName()Returns this tag class name.intgetTagNumber()Returns this tag number.booleanisConstructed()Returns whether this tag is constructed.bytenumber(int tagNumber)Returns the byte representation of this tag having the provided tag number.static Asn1TagprivateTag()Returns a primitive ASN.1 tag with the private tag class.StringtoString()Returns the string representation of this Asn1 tag.static StringtoString(byte tag)Returns a string representation of the provided tag.static Asn1Taguniversal()Returns a primitive ASN.1 tag with the universal tag class.static Asn1TagvalueOf(byte tag)Converts the provided byte to an Asn1Tag.
-
-
-
Method Detail
-
toString
public static String toString(byte tag)
Returns a string representation of the provided tag.- Parameters:
tag- The tag to be represented as a string.- Returns:
- The string representation of this tag.
-
valueOf
public static Asn1Tag valueOf(byte tag)
Converts the provided byte to an Asn1Tag.- Parameters:
tag- The byte to be converted.- Returns:
- The Asn1Tag corresponding to the provided tag byte.
-
universal
public static Asn1Tag universal()
Returns a primitive ASN.1 tag with the universal tag class.- Returns:
- A primitive ASN.1 tag with the universal tag class.
-
application
public static Asn1Tag application()
Returns a primitive ASN.1 tag with the application tag class.- Returns:
- A primitive ASN.1 tag with the application tag class.
-
contextSpecific
public static Asn1Tag contextSpecific()
Returns a primitive ASN.1 tag with the context-specific tag class.- Returns:
- A primitive ASN.1 tag with the context-specific tag class.
-
privateTag
public static Asn1Tag privateTag()
Returns a primitive ASN.1 tag with the private tag class.- Returns:
- A primitive ASN.1 tag with the private tag class.
-
constructed
public Asn1Tag constructed()
Changes this ASN.1 tag from primitive to constructed.- Returns:
- this ASN.1 tag.
-
number
public byte number(int tagNumber)
Returns the byte representation of this tag having the provided tag number.- Parameters:
tagNumber- The tag number.- Returns:
- The byte representation of this tag having the provided tag number.
-
getClassName
public Asn1Tag.Class getClassName()
Returns this tag class name.- Returns:
- This tag class name.
-
isConstructed
public boolean isConstructed()
Returns whether this tag is constructed.- Returns:
trueif this tag is constructed,falseif it is primitive.
-
getTagNumber
public int getTagNumber()
Returns this tag number.- Returns:
- This tag number.
-
toString
public String toString()
Returns the string representation of this Asn1 tag. The string value corresponds to the chain of methods that should be called to produce the same Asn1 tag, e.g."contextSpecific().constructed().number(3)".
-
-