Package com.oss.asn1
Class OpenType
java.lang.Object
com.oss.asn1.AbstractData
com.oss.asn1.AbstractOpenType
com.oss.asn1.OpenType
- All Implemented Interfaces:
com.oss.asn1.PDUContainer
,Serializable
,Cloneable
The OpenType class represents the ASN.1 ANY and the open type. This class
is used to carry any valid ASN.1 type as an open type.
- Since:
- ASN.1/Java 1.0-beta A
- See Also:
-
Field Summary
Fields inherited from class com.oss.asn1.AbstractData
EQUALS, GREATER_THAN, LESS_THAN
-
Constructor Summary
ConstructorsConstructorDescriptionOpenType()
The default constructor.OpenType
(byte[] encodedValue) Construct an instance of this class with a byte array that represents the encoding of a valid ASN.1 type.OpenType
(byte[] encodedValue, TransferSyntax transferSyntax) Construct an instance of this class with a byte array that represents the encoding of a valid ASN.1 type.OpenType
(AbstractData decodedValue) Construct an instance of this class with an AbstractData object that represents an unencoded value of a valid ASN.1 type.OpenType
(AbstractData pdu, Coder coder) Construct an instance of this class with a PDU object reference that represents the un-encoded value of a valid ASN.1 type. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clone 'this' object.void
delete()
Destroy the instance of the AbstractData.final boolean
Compare 'this' object to another OpenType object to see if their contents are the same.final byte[]
Get the encoding of an instance of a valid ASN.1 type.final InputStream
Get the encoding of an instance of a valid ASN.1 type.int
hashCode()
Returns a hash code for this objectvoid
setDecodedValue
(AbstractData decodedValue) Set the unencoded data of a valid ASN.1 type.void
setEncodedValue
(byte[] encodedValue) Set the encoded data, an encoding of a valid ASN.1 type.void
setEncodedValue
(byte[] encodedValue, TransferSyntax transferSyntax) Set the encoded data, an encoding of a valid ASN.1 type.Methods inherited from class com.oss.asn1.AbstractOpenType
getDecodedValue, getTransferSyntax
Methods inherited from class com.oss.asn1.AbstractData
equals, isEncodable, isPDU, isValid, toString, toString
-
Constructor Details
-
OpenType
public OpenType()The default constructor. -
OpenType
public OpenType(AbstractData pdu, Coder coder) throws EncodeNotSupportedException, EncodeFailedException Construct an instance of this class with a PDU object reference that represents the un-encoded value of a valid ASN.1 type. The "coder" will be used to encode the 'pdu' into a byte array.- Parameters:
pdu
- an AbstractData object representing a PDU.coder
- a Coder object used to encode "pdu".- Throws:
EncodeNotSupportedException
- when encoding disabled.EncodeFailedException
- when "pdu" cannot be encoded.
-
OpenType
public OpenType(byte[] encodedValue) Construct an instance of this class with a byte array that represents the encoding of a valid ASN.1 type.- Parameters:
encodedValue
- the byte array of encoded data to set.
-
OpenType
Construct an instance of this class with a byte array that represents the encoding of a valid ASN.1 type.- Parameters:
encodedValue
- the byte array of encoded data to set.transferSyntax
- identifier of the encoding rules of this encoded data
-
OpenType
Construct an instance of this class with an AbstractData object that represents an unencoded value of a valid ASN.1 type.- Parameters:
decodedValue
- the AbstractData object to set.
-
-
Method Details
-
getEncodedValue
public final byte[] getEncodedValue()Get the encoding of an instance of a valid ASN.1 type. This will be useful when manual decoding has been used. Manual decoding is used by default or whendisableAutomaticDecoding()
is invoked.- Returns:
- byte array representing the encoded data.
-
getEncodedValueAsStream
Get the encoding of an instance of a valid ASN.1 type. This will be useful when manual decoding has been used. The stream returned can be passed as the first parameter to thedecode
method of theCoder
. Manual decoding is used by default or whendisableAutomaticDecoding()
is invoked.- Specified by:
getEncodedValueAsStream
in classAbstractOpenType
- Returns:
- InputStream representing the encoded data.
-
setEncodedValue
public void setEncodedValue(byte[] encodedValue) Set the encoded data, an encoding of a valid ASN.1 type.- Parameters:
encodedValue
- the byte array of encoded data to set.
-
setEncodedValue
Set the encoded data, an encoding of a valid ASN.1 type.- Parameters:
encodedValue
- the byte array of encoded data to set.transferSyntax
- identifier of the encoding rules of this encoded data
-
setDecodedValue
Set the unencoded data of a valid ASN.1 type.- Specified by:
setDecodedValue
in interfacecom.oss.asn1.PDUContainer
- Overrides:
setDecodedValue
in classAbstractOpenType
- Parameters:
decodedValue
- the reference to the AbstractData object to set.
-
equalTo
Compare 'this' object to another OpenType object to see if their contents are the same.- Parameters:
that
- the OpenType object to compare 'this' object to.- Returns:
- true if contents of both objects are the same.
-
clone
Clone 'this' object.- Overrides:
clone
in classAbstractData
- Returns:
- deep copy of 'this' object.
-
delete
public void delete()Destroy the instance of the AbstractData. The contract of this method is to facilitate garbage collection by explicit destruction of the data that is no longer needed.- Overrides:
delete
in classAbstractOpenType
-
hashCode
public int hashCode()Returns a hash code for this object- Overrides:
hashCode
in classAbstractData
- Returns:
- a hash code for this object
-