TOC PREV NEXT INDEX


Generated Java Method Format and Calling Parameters



The signature for a Java XER encode method is as follows:

   public void encode (Asn1XerEncoder buffer, String elemName)
 
      throws Asn1Exception, java.io.IOException
 

The buffer argument is a reference to an Asn1XerEncoder derived object that describes the buffer or output stream into which a message is to be encoded. Asn1XerEncoder is a base interface for the Asn1XerEncodeBuffer and Asn1XerOutputStream classes. Thus, there is no difference which encode method is used: output stream or message buffer. The generated logic is the same, the difference is only in the first parameter of the encode method. This must be created and initialized before calling any encode method. See the description of this class in the Java Run-Time Classes section for details on how this class is used.

The elemName argument is a reference to a string containing the element name text. This text is used to form the standard XML angle-bracketed wrapper that is applied to each element in a message. Note the name passed must not contain the angle-brackets (i.e. the < > characters). These will be added by the encode method.

The elemName can be passed in different ways to control how the name is applied. The normal way is to pass a name that is applied as the element name of the element. If null is passed, then the default element name for the referenced ASN.1 built-in type is used. For example, <BOOLEAN> is the default element name for the ASN.1 BOOLEAN type. The complete list of default element names can be found in the X.693 standard. If an empty string is passed (i.e. ""), this tells the encode method to omit the element name string all together and just encode the value (this is similar to implicit tagging in the BER case).

The XER encode methods do not return a value. This is different than the C/C++ version that returns a negative status value to indicate an encoding failure. For Java, errors are reported via the exception mechanism. All ASN1C Java exceptions are derived from the Asn1Exception base class. See the section on exceptions for a complete list and description of the various exceptions that can be thrown. If I/O error occurs then the java.io.IOException is thrown.


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

Copyright © 1997-2004 Objective Systems,Inc.
All Rights Reserved.


This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.