Encode Method
public int encode (Asn1BerEncodeBuffer buffer, boolean explicit);The Asn1BerEncodeBuffer argument specifies the buffer into which the message will be encoded. The explicit argument is primarily for use by the compiler for generating internal calls to handle implicitly tagged elements in constructed types. Users should always set this argument to true.
The encode method returns the length of the encoded component. Unlike the C /C++ version, this return value does not double as a status value as well. Any errors that occur in the encode process are reported by throwing an ASN1C exception. A complete list of these exceptions can be found in the ASN1C Exceptions section.
public void encode (Asn1PerEncodeBuffer buffer);In this case, the explicit argument is not required since PER has no tagging. The only required argument is a reference to an encode buffer object. Also note that the return value is void instead of int. No intermediate lengths are returned during the encoding of a PER message. Any errors that occur are reported as an exception; hence there I no need for a return value.
public void encode (Asn1XerEncodeBuffer buffer, String elemName);In this case, the buffer reference is to an XER encode buffer and an element name argument is added. The element name is the name of the element that is to bracket the XML encoded value (i.e. <elemName>value</elemName>). The return type is also void as in the PER case because errors are reported throught the exception mechanism.
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, 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 |