|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.jss.asn1.ANY
public class ANY
Represents an ASN.1 ANY
value. An ANY is just an arbitrary
ASN.1 value. It can be thought of as the simplest implementation of the
ASN1Value
interface. Although they can be created
from scratch (from raw BER), instances of ANY
are usually
found after decoding
with a template that has an ANY
field.
An ANY
supports extracting the BER encoding, or decoding
with a different template.
Nested Class Summary | |
---|---|
static class |
ANY.Template
A class for decoding ANY values from BER. |
Constructor Summary | |
---|---|
ANY(byte[] encoded)
Creates an ANY value, which is just a generic ASN.1 value. |
|
ANY(Tag tag,
byte[] encoded)
Creates an ANY value, which is just a generic ASN.1 value. |
Method Summary | |
---|---|
ASN1Value |
decodeWith(ASN1Template template)
Decodes this ANY using the given template. |
ASN1Value |
decodeWith(Tag implicitTag,
ASN1Template template)
Decodes this ANY using the given template. |
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using its own base tag. |
void |
encode(Tag implicitTag,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using an implicit tag. |
void |
encodeWithAlternateTag(Tag alternateTag,
java.io.OutputStream ostream)
Extracts the contents from the ANY and encodes them with the provided tag. |
byte[] |
getContents()
|
byte[] |
getEncoded()
Returns the complete encoding of header and contents, as passed into the constructor or read from a BER input stream. |
ASN1Header |
getHeader()
Returns the ASN.1 header from the encoding. |
Tag |
getTag()
Returns the tag of this value. |
static ANY.Template |
getTemplate()
Returns a singleton instance of a decoding template. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ANY(Tag tag, byte[] encoded)
tag
- The tag of this value. It must be the same as the actual tag
contained in the encoding.encoded
- The complete BER encoding of this value, including
tag, form, length, and contents.public ANY(byte[] encoded) throws InvalidBERException
encoded
- The complete BER encoding of this value, including
tag, form, length, and contents.
InvalidBERException
Method Detail |
---|
public Tag getTag()
getTag
in interface ASN1Value
public byte[] getEncoded()
public ASN1Header getHeader() throws InvalidBERException, java.io.IOException
InvalidBERException
java.io.IOException
public byte[] getContents() throws InvalidBERException
InvalidBERException
public void encode(java.io.OutputStream ostream) throws java.io.IOException
ASN1Value
encode
in interface ASN1Value
java.io.IOException
public ASN1Value decodeWith(ASN1Template template) throws InvalidBERException
template
- The template to use to decode this ANY.
InvalidBERException
public ASN1Value decodeWith(Tag implicitTag, ASN1Template template) throws java.io.IOException, InvalidBERException
implicitTag
- The implicit tag for the encoding.template
- The template to use to decode this ANY.
java.io.IOException
InvalidBERException
public void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
ASN1Value
encode
in interface ASN1Value
implicitTag
- This parameter is ignored, because
ANY values cannot have implicit tags.
java.io.IOException
public void encodeWithAlternateTag(Tag alternateTag, java.io.OutputStream ostream) throws java.io.IOException, InvalidBERException
java.io.IOException
InvalidBERException
public static ANY.Template getTemplate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |