com.objsys.asn1j.runtime
Class Asn1OpenType

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1Type
      extended by com.objsys.asn1j.runtime.Asn1OctetString
          extended by com.objsys.asn1j.runtime.Asn1OpenType
All Implemented Interfaces:
Asn1TypeIF, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
Asn1ChoiceExt, Asn1XerOpenType

public class Asn1OpenType
extends Asn1OctetString

This is a container class for holding the an ASN.1 open type value.

See Also:
Serialized Form

Field Summary
protected  Asn1EncodeBuffer mEncodeBuffer
           
protected  int mLength
           
protected  boolean mTextEncoding
           
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1OctetString
TAG, value
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1Type
BIT_STRING, BMPString, BOOLEAN, ENUMERATED, EOC, EXTERNAL, GeneralString, GeneralTime, GraphicString, IA5String, INTEGER, NULL, NumericString, OBJECT_IDENTIFIER, ObjectDescriptor, OCTET_STRING, OpenType, PrintableString, REAL, RelativeOID, SEQUENCE, SET, T61String, TeletexString, UniversalString, UTCTime, UTF8String, VideotexString, VisibleString
 
Constructor Summary
Asn1OpenType()
          This constructor creates an empty type that can be used in a decode method call to receive an encoded value.
Asn1OpenType(Asn1EncodeBuffer buffer)
          This constructor initializes an open type using an encoded component.
Asn1OpenType(byte[] data)
          This constructor initializes an open type from the given byte array.
Asn1OpenType(byte[] data, int offset, int nbytes)
          This constructor initializes the open type from a portion of the given byte array.
Asn1OpenType(int length)
          This constructor initializes an open type using just an encoded component length.
 
Method Summary
 void decode(Asn1BerDecodeBuffer buffer, boolean explicit, int implicitLength)
          This method decodes an ASN.1 open type value.
 int encode(Asn1BerEncodeBuffer buffer, boolean explicit)
          This method encodes an ASN.1 open type value.
 void encode(Asn1BerOutputStream out, boolean explicit)
          This method encodes and writes to the stream an ASN.1 open type value including the UNIVERSAL tag value and length if explicit tagging is specified.
 void encode(Asn1PerEncodeBuffer buffer)
          This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER).
 void encode(Asn1PerOutputStream out)
          This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER).
 java.lang.String toString()
          This method will return a string representation of the open type value.
 
Methods inherited from class com.objsys.asn1j.runtime.Asn1OctetString
compareTo, decode, decode, decodeXER, decodeXML, encode, encode, encode, encode, encodeAttribute, equals, equals, getLength, toInputStream
 
Methods inherited from class com.objsys.asn1j.runtime.Asn1Type
clone, decode, decode, decode, encode, encode, encode, getTypeName, indent, isOpenType, matchTag, matchTag, pdiag, print, setKey, setOpenType
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mLength

protected transient int mLength

mEncodeBuffer

protected transient Asn1EncodeBuffer mEncodeBuffer

mTextEncoding

protected transient boolean mTextEncoding
Constructor Detail

Asn1OpenType

public Asn1OpenType()
This constructor creates an empty type that can be used in a decode method call to receive an encoded value.


Asn1OpenType

public Asn1OpenType(byte[] data)
This constructor initializes an open type from the given byte array. The array is assumed to contain a previously encoded message component.

Parameters:
data - Byte array containing a previously encoded message component.

Asn1OpenType

public Asn1OpenType(byte[] data,
                    int offset,
                    int nbytes)
This constructor initializes the open type from a portion of the given byte array. A new byte array is created starting at the given offset and consisting of the given number of bytes.

Parameters:
data - Byte array containing an octet string in binary form.
offset - Starting offset in data from which to copy bytes
nbytes - Number of bytes to copy from target array

Asn1OpenType

public Asn1OpenType(Asn1EncodeBuffer buffer)
This constructor initializes an open type using an encoded component. This can be used if a header (for example, a ROSE header) is being prepended to a pre-encoded component.

Parameters:
buffer - Reference to encode buffer into which component type was encoded.

Asn1OpenType

public Asn1OpenType(int length)
This constructor initializes an open type using just an encoded component length. This can be used if a header (for example, a ROSE header) is being prepended to a pre-encoded component. This form of the constructor is only being maintained for compatibility with previous versions. The preferred way to use a pre-encoded component is to use the version of the constructor that takes an Asn1BerEncodeBuffer argument. The result is the same, but the print method will not work if this version is used.

Parameters:
length - Length of the pre-encoded component. This must be the last item in the type and already exist in the encode buffer.
Method Detail

decode

public void decode(Asn1BerDecodeBuffer buffer,
                   boolean explicit,
                   int implicitLength)
            throws Asn1Exception,
                   java.io.IOException
This method decodes an ASN.1 open type value.

Specified by:
decode in interface Asn1TypeIF
Overrides:
decode in class Asn1OctetString
Parameters:
buffer - Decode message buffer object
explicit - Flag indicating element is explicitly tagged
implicitLength - Length of contents if implicit
Throws:
Asn1Exception
java.io.IOException

encode

public int encode(Asn1BerEncodeBuffer buffer,
                  boolean explicit)
           throws Asn1Exception
This method encodes an ASN.1 open type value. The value is assumed to be an already-encoded message component and will be copied to the encoded buffer. An optimization is available in which no copy will performed if the encoded component is already present in the encode buffer. This is done if the form of constructor specifiying only a component length is used.

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn1OctetString
Parameters:
buffer - Encode message buffer object
explicit - Flag indicating element is explicitly tagged
Returns:
Length of encoded component
Throws:
Asn1Exception

encode

public void encode(Asn1PerEncodeBuffer buffer)
            throws Asn1Exception,
                   java.io.IOException
This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER).

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn1OctetString
Parameters:
buffer - Encode message buffer object
Throws:
Asn1Exception
java.io.IOException

toString

public java.lang.String toString()
This method will return a string representation of the open type value. The format is the ASN.1 value format for this type..

Overrides:
toString in class Asn1OctetString
Returns:
Stringified representation of the value

encode

public void encode(Asn1BerOutputStream out,
                   boolean explicit)
            throws Asn1Exception,
                   java.io.IOException
This method encodes and writes to the stream an ASN.1 open type value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn1OctetString
Parameters:
out - BER Output Stream object
explicit - Flag indicating explicit tagging should be done
Throws:
java.io.IOException - Any exception thrown by the underlying OutputStream.
Asn1Exception - Thrown, if operation is failed.

encode

public void encode(Asn1PerOutputStream out)
            throws Asn1Exception,
                   java.io.IOException
This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER).

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn1OctetString
Parameters:
out - PER Output Stream object
Throws:
java.io.IOException - Any exception thrown by the Asn1PerOutputStream.
Asn1Exception - Thrown, if operation is failed.