public class UNKNOWN extends ConstructedType
This class only supports decoding facilities for properly handling any DER encoded ASN.1 objects with an unknown tag specification.
Whenever the DerCoder
parses a tag it does not
know of, it creates a UNKNOWN
object and supplies it with the
content octets read from the decoding. In this way, an application may ask
for the pure content bytes by means of the getValue()
method.
content_count, content_data
asnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode
Constructor and Description |
---|
UNKNOWN()
Creates an empty UNKNOWN ASN.1 type.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this UNKNOWN.
|
protected void |
decode(int length,
java.io.InputStream is)
Decodes the value of an UMKNOWN ASN.1 object from the given input stream.
|
protected void |
encode(java.io.OutputStream os)
Tries to encode this UNKOWN ASN.1 object.
|
ASN |
getBaseAsnType()
Returns the base ASN.1 type of this UNKNOWN ASN.1 object.
|
java.lang.Object |
getValue()
Returns the value of this UNKNOWN ASN.1 object as a byte array.
|
void |
setValue(java.lang.Object object)
Sets the value of this object to value.
|
java.lang.String |
toString()
Returns a string that represents the contents of this UNKNOWN ASN.1 type.
|
addComponent, addComponent, addEncodeListener, countComponents, getComponentAt, getComponents, removeComponent, removeComponent, setComponent
addEncodeListener, encodeObject, getAsnType, indefiniteLength, isA, isConstructed, isStringType, setIndefiniteLength
public java.lang.Object clone()
clone
in class ConstructedType
public void setValue(java.lang.Object object)
setValue
in class ConstructedType
object
- the new value as a byte arraypublic java.lang.Object getValue()
getValue
in class ConstructedType
public ASN getBaseAsnType()
This method may be used to query for the ASN.1 type (tag class and tag
value) of the base ASN1Object this UNKNOWN represents. Note that the
DerCoder creates an UNKNOWN object for any ASN.1 object it does not know of
(i.e. has no registered implementation for the corresponding ASN.1 type).
An UNKNOWN object is allocated the tag value 0 since it is not used in
ASN.1 at all. Therefore, when calling method
getAsnType
of an UNKNOWN object
you anytime will get an ASN1 type representing tag class UNIVERSAL with tag
number 0 (since this is the ASN.1 type of the UNKNOWN implementation). To
get the ASN.1 type of the base ASN.1 object you may call this
getBaseAsnType
method.
ASN
protected void encode(java.io.OutputStream os) throws java.io.IOException
encode
in class ConstructedType
os
- the output stream to which to write the encoded objectjava.io.IOException
- if the UNKOWN type cannot be encodedprotected void decode(int length, java.io.InputStream is) throws java.io.IOException
DerCoder
parses a tag it
does not know of, it creates an UNKNOWN
object and uses this
decode
method for reading the raw content octets from the
decoding stream.decode
in class ConstructedType
length
- the already decoded length, i.e. number of the bytes occupied by
the value of the UNKNOWN ASN.1 object to be decodedis
- the input stream from which the der encoded data is read injava.io.IOException
- if there is a problem with the InputStreampublic java.lang.String toString()
toString
in class ASN1Object
ASN1Object.toString()