The following items may be present in a generated java file:
Package specification
Import statements
Class declaration
A tag constant object declaration
Public member variables
Constructors
Public decode() method
Public encode() method
Other methods
Inner SAX Handler class (XER or XML only)
Additional specialized items may be present as well depending on the base type of the target production. These specialized items are discussed in the sections on ASN.1 to Java mappings for the various ASN.1 types.
A complete generated Java source file for the 'EmployeeNumber' production within the production within the ASN.1 sample file 'employee.asn' can be found on the following page. The ASN.1 production from which this file was generated is as follows:
EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
The generated code is as follows:
package sample_ber.Employee; import com.objsys.asn1j.runtime.*; import java.io.*; import java.util.*; public class EmployeeNumber extends Asn1Integer { public final static Asn1Tag TAG = new Asn1Tag (Asn1Tag.APPL, Asn1Tag.PRIM, 2); public EmployeeNumber() { super(); } public EmployeeNumber (int value_) { super (value_); } pubilc void decode (Asn1BerDecodeBuffer buffer, boolean explicit, int implicitLength) throws Asn1Exception, java.io.IOException { final int llen = (explicit) ? matchTag (buffer, TAG) : implicitLength; super.decode (buffer, false, llen); if (explicit && llen == Asn1Status.INDEFLEN) { matchTag (buffer, Asn1Tag.EOC); } } public int encode (Asn1BerEncodeBuffer buffer, boolean explicit) throws Asn1Exception { int aal = super.encode (buffer, false); if (explicit) { aal += buffer.encodeTagAndLength (TAG, aal); } return (aal); } }