Package org.mozilla.jss.asn1
Class CHOICE
java.lang.Object
org.mozilla.jss.asn1.CHOICE
- All Implemented Interfaces:
ASN1Value
Objects of this class are generated by CHOICE.Template.decode(). It is
not necessary to use them to encode a CHOICE. Since the encoding of a
CHOICE is simply the encoding of the chosen element, it is easier
to just write out the chosen element.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A Template for decoding ASN.1CHOICE
s -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(OutputStream ostream) Encodes this CHOICE.void
encode
(Tag implicitTag, OutputStream ostream) Encodes this CHOICE.getTag()
Returns the tag that the chosen element is encoded with, which is either the underlying tag of the element or an implicit tag.static CHOICE.Template
getValue()
-
Field Details
-
tag
-
val
-
-
Constructor Details
-
CHOICE
Create a CHOICE whose chosen element has an implicit tag.- Parameters:
implicitTag
- Implicit tag.val
- The value.
-
CHOICE
Create a CHOICE whose chosen element has no implicit tag.- Parameters:
val
- The value.
-
-
Method Details
-
getTag
Returns the tag that the chosen element is encoded with, which is either the underlying tag of the element or an implicit tag. -
getValue
- Returns:
- The chosen value.
-
getTemplate
-
encode
Encodes this CHOICE. This merely consists of encoding the chosen element with an implicit tag, if one was given in the constructor, or with its own underlying tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
encode
Encodes this CHOICE. This merely consists of encoding the chosen element with an implicit tag, if one was given in the constructor, or with its own underlying tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
implicitTag
- This value is ignored. The tag of a CHOICE is merely the tag of the chosen element of the CHOICE. A CHOICE cannot itself have an implicit tag.ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-