|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectschemajic.schema.Tag
public class Tag
Processing support necessary to provide an ASN.1 tagged-type capability. Excerpted from X.680-0207...
30 Notation for tagged types
A tagged type (see 3.6.70) is a new type which is isomorphic with an old type, but which has a different tag. The tagged
type is mainly of use where this Recommendation | International Standard requires the use of types with distinct tags
(see 24.5 to 24.6, 26.3 and 28.3). The use of a "TagDefault" of AUTOMATIC TAGS in a module allows this to be
accomplished without the explicit appearance of tagged type notation in that module.
NOTE – Where a protocol determines that values from several data types may be transmitted at any moment in time, distinct tags
may be needed to enable the recipient to correctly decode the value.
30.1 The notation for a tagged type shall be "TaggedType":
TaggedType ::=
Tag Type
| Tag IMPLICIT Type
| Tag EXPLICIT Type
Tag ::= "[" Class ClassNumber "]"
ClassNumber ::=
number
| DefinedValue
Class ::=
UNIVERSAL
| APPLICATION
| PRIVATE
| empty
30.2 The "valuereference" in "DefinedValue" shall be of type integer, and assigned a non-negative value.
30.3 The new type is isomorphic with the old type, but has a tag with class "Class" and number "ClassNumber",
except when "Class" is "empty", in which case the tag is context-specific class and number is "ClassNumber".
30.4 The "Class" shall not be UNIVERSAL except for types defined in this Recommendation | International Standard.
NOTE 1 – Use of universal class tags are agreed from time-to-time by ITU-T and ISO.
NOTE 2 – Subclause E.2.12 contains guidance and hints on stylistic use of tag classes.
30.5 All application of tags is either implicit tagging or explicit tagging. Implicit tagging indicates, for those
encoding rules which provide the option, that explicit identification of the original tag of the "Type" in the
"TaggedType" is not needed during transfer.
NOTE – It can be useful to retain the old tag where this was universal class, and hence unambiguously identifies the old type
without knowledge of the ASN.1 definition of the new type. Minimum transfer octets is, however, normally achieved by the use
of IMPLICIT. An example of an encoding using IMPLICIT is given in ITU-T Rec. X.690 | ISO/IEC 8825-1.
30.6 The tagging construction specifies explicit tagging if any of the following holds:
a) the "Tag EXPLICIT Type" alternative is used;
b) the "Tag Type" alternative is used and the value of "TagDefault" for the module is either EXPLICIT
TAGS or is empty;
c) the "Tag Type" alternative is used and the value of "TagDefault" for the module is IMPLICIT TAGS or
AUTOMATIC TAGS, but the type defined by "Type" is an untagged choice type, an untagged open type, or
an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3).
The tagging construction specifies implicit tagging otherwise.
30.7 If the "Class" is "empty", there are no restrictions on the use of "Tag", other than those implied by the
requirement for distinct tags in 24.5 to 24.6, 26.3 and 28.3.
30.8 The IMPLICIT alternative shall not be used if the type defined by "Type" is an untagged choice type or an
untagged open type or an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3).
30.9 The notation for a value of a "TaggedType" shall be "TaggedValue", or when used as an "XMLValue",
"XMLTaggedValue". These productions are:
TaggedValue ::= Value
XMLTaggedValue ::= XMLValue
where "Value" or "XMLValue" is a notation for a value of the "Type" in the "TaggedType".
NOTE: _tagMode is only relevant when the tag is part of a Type's metadata.
| Field Summary | |
|---|---|
static byte |
CONSTRUCTED
|
static byte |
CONTEXT_SPECIFIC
|
static byte |
PRIMITIVE
|
static byte |
UNIVERSAL
|
| Constructor Summary | |
|---|---|
Tag(int tclass,
int pc,
int number)
Constructor for Tag with initialization parameters. |
|
Tag(java.lang.String s)
Constructor for Tag with string initialization parameter. |
|
| Method Summary | |
|---|---|
static Tag |
decode(java.io.InputStream in)
Decodes an ASN.1 tag from an input stream. |
void |
encode(java.io.OutputStream out)
Encodes the current encoding value to an output stream. |
int |
getTagClass()
returns the tag class assigned to a type in the ASN.1 standards |
int |
getTagNumber()
returns the tag number assigned to a type in the ASN.1 standards |
int |
getTagPC()
returns the tagPC |
boolean |
isConstructed()
Determines if an ASN.1 tag is constructed. |
boolean |
isContextSpecific()
Determines if the current class of ASN.1 tag is context specific. |
boolean |
isExplicit()
Return true if the tagging mode for this tag is EXPLICIT. |
boolean |
isPrimitive()
Determines if an ASN.1 tag is primitive. |
boolean |
isVisible()
Based on whether the tag modifier is EXPLICIT or IMPLICIT, and the default tagging for the module, return true if the tag is visible in a DER encoding. |
boolean |
matches(java.io.InputStream in)
Determines if a given ASN.1 tag matches the data in an input stream. |
java.lang.String |
toString()
Returns the hexadecimal representation of an ASN.1 encoding. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte UNIVERSAL
public static final byte CONTEXT_SPECIFIC
public static final byte PRIMITIVE
public static final byte CONSTRUCTED
| Constructor Detail |
|---|
public Tag(java.lang.String s)
throws java.text.ParseException
Tag with string initialization parameter.
s - initialization value
java.text.ParseException
public Tag(int tclass,
int pc,
int number)
Tag with initialization parameters.
tclass - class of this ASN.1 tagpc - tag counternumber - tag number| Method Detail |
|---|
public boolean isExplicit()
Note that this condition is only relevant when the given tag is part of a schema.
public int getTagClass()
public int getTagNumber()
public int getTagPC()
public boolean matches(java.io.InputStream in)
throws java.io.IOException
in - an input stream
boolean true or false
java.io.IOExceptionpublic boolean isContextSpecific()
boolean true or falsepublic boolean isPrimitive()
boolean true or falsepublic boolean isConstructed()
boolean true or falsepublic boolean isVisible()
boolean true if visiblepublic java.lang.String toString()
toString in class java.lang.Object
public static Tag decode(java.io.InputStream in)
throws java.io.IOException
in - an input stream
java.io.IOException
public void encode(java.io.OutputStream out)
throws EncodingException
encode in interface Encodableout - provided output stream encoding target
EncodingException
|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||