TOC PREV NEXT INDEX


Generated Java Method Format and Calling Parameters



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

   public int encode (Asn1BerEncodeBuffer buffer, boolean explicit)
 
      throws Asn1Exception
 


The buffer argument is a reference of an Asn1BerEncodeBuffer object that describes the buffer into which a message is being encoded. 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 explicit argument specifies whether or not an explicit tag should be applied to the encoded contents. The average user will almost always want to set this argument to true. The only time it would not be set to true is if a user wanted to just encode a contents field with no tag. This argument is used primarily by the compiler when generating internal calls to properly handle implicit and explicit tagging.

The return value is the length in octets of the encoded message component. Unlike the C/C++ version, a negative value is never returned to indicate an encoding failure. That is handled by 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.


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-2005 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.