org.mozilla.jss.asn1

Class Tag

public class Tag extends Object

Represents an ASN.1 Tag. A tag consists of a class and a number.
Nested Class Summary
static classTag.Class
An enumeration of the ASN.1 tag classes.
Field Summary
static Tag.ClassAPPLICATION
A tag class.
static Tag.ClassCONTEXT_SPECIFIC
A tag class.
static TagEND_OF_CONTENTS
The end-of-contents marker for indefinite length encoding.
static TagEOC
An alias for END_OF_CONTENTS.
static Tag.ClassPRIVATE
A tag class.
static Tag.ClassUNIVERSAL
A tag class.
Constructor Summary
Tag(Tag.Class clazz, long num)
Creates a tag with the given class and number.
Tag(long num)
Creates a CONTEXT-SPECIFIC tag with the given tag number.
Method Summary
booleanequals(Object obj)
Compares two tags for equality.
static Tagget(long num)
Returns an instance of a context-specific tag with the given number.
longgetNum()
Returns the tag number.
Tag.ClassgetTagClass()
Returns the tag class.
inthashCode()
StringtoString()
Returns a String representation of the tag.

Field Detail

APPLICATION

public static final Tag.Class APPLICATION
A tag class.

CONTEXT_SPECIFIC

public static final Tag.Class CONTEXT_SPECIFIC
A tag class.

END_OF_CONTENTS

public static final Tag END_OF_CONTENTS
The end-of-contents marker for indefinite length encoding. It is encoded the same as an ASN.1 header whose tag is [UNIVERSAL 0].

EOC

public static final Tag EOC
An alias for END_OF_CONTENTS.

PRIVATE

public static final Tag.Class PRIVATE
A tag class.

UNIVERSAL

public static final Tag.Class UNIVERSAL
A tag class.

Constructor Detail

Tag

public Tag(Tag.Class clazz, long num)
Creates a tag with the given class and number.

Parameters: clazz The class of the tag. num The tag number.

Tag

public Tag(long num)
Creates a CONTEXT-SPECIFIC tag with the given tag number.

Parameters: num The tag number.

Method Detail

equals

public boolean equals(Object obj)
Compares two tags for equality. Tags are equal if they have the same class and tag number.

get

public static Tag get(long num)
Returns an instance of a context-specific tag with the given number. The returned instance may be singleton. It is usually more efficient to call this method than create your own context-specific tag.

getNum

public long getNum()
Returns the tag number.

getTagClass

public Tag.Class getTagClass()
Returns the tag class.

hashCode

public int hashCode()

toString

public String toString()
Returns a String representation of the tag. For example, a tag whose class was UNIVERSAL and whose number was 16 would return "UNIVERSAL 16".