TOC PREV NEXT INDEX


Open Type



Note: The X.680 Open Type replaces the X.208 ANY or ANY DEFINED BY constructs. An ANY or ANY DEFINED BY encountered within an ASN.1 module will result in the generation of code corresponding to the Open Type described below.

The ASN.1 Open Type is converted into a Java class that extends the Asn1OpenType class. This class in turn extends the Asn1OctetString class and provides the following public member variable for storing the encoded message component:

	public byte[] value;
 

The number of octets to be encoded or that were decoded is specified in the built-in length component of the array object (i.e., value.length).

The following shows the basic mapping from ASN.1 type to Java class definition:

ASN.1 Production:
<name> ::= <openType>


 
Generated Java class:

public class <name> extends Asn1OpenType {
 
   public <name> () {
 
      super();
 
   }
 

 
   public <name> (byte[] data) {
 
      super (data);
 
   }
 

 
   public <name> (byte[] data, 
 
                  int offset, 
 
                  int nbytes) 
 
   {
 
      super (data, offset, nbytes);
 
   }
 

 
   public <name> (Asn1EncodeBuffer buffer) {
 
     super ();
 
   }
 
}


 

The <openType> placeholder is to be replaced with any type of open type specification. It could be the ANY or ANY DEFINED BY keywords from the X.208 specification or an open type from X.681 (for example, TYPE-IDENTIFIER.&Type).

The last form of the constructor shown above is for an optimized form of Open Type encoding. When encoding is done using BER, an open type header can be directly added to the beginning of an encoded message component. By using this form of the constructor, you are indicating to the run-time encoder that the encoded message component onto which a header is to be added is already present in the message buffer. The advantage is that binary copies of the encoded message components are avoided both from the encode buffer to the open type object and from the open type object back to the encode buffer.

For XER, a new class derived from the Asn1OpenType class was created. This is the Asn1XerOpenType class and this must be used whenever an open type is required for XER. The reason for creating a special derived class is because of dependencies on XML parser classes defined within this class. If these were added directly to the Asn1OpenType class, a user would need to always have XML parser .jar files included in their classpath - even if working with BER, DER, or PER only.


Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX