com.objsys.asn1j.runtime
Class Asn1Context

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1Context

public class Asn1Context
extends java.lang.Object

This class is a holder for things which are to be contained in an encoder or decoder. Since we have multiple base classes for encoders/decoders (Asn1MessageBuffer and Asn1OutputStream), this class provides a single container for all of those things which would otherwise be contained in the various base classes. This class also provides a location for some convenience methods related to the contained objects (e.g. getCurrentElement). Thread-safety: a given instance of this class should be accessed by a single thread.


Field Summary
 Asn1NamedEventDispatcher eventDispatcher
          The named event dispatcher for this context.
 
Constructor Summary
Asn1Context()
           
 
Method Summary
 void enableElementTracking()
          Enable element name tracking.
 java.lang.String getCurrentElement()
          Return the name of the current element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventDispatcher

public Asn1NamedEventDispatcher eventDispatcher
The named event dispatcher for this context.

Constructor Detail

Asn1Context

public Asn1Context()
Method Detail

enableElementTracking

public void enableElementTracking()
Enable element name tracking. This can be useful for error reporting. Element name tracking must be enabled for getCurrentElement to be of any use.


getCurrentElement

public java.lang.String getCurrentElement()
Return the name of the current element. This is only useful if you have called enableElementTracking at the start of encoding/decoding. The name returned will be in the form element1.element2..., If you have not enabled element tracking, an exception will be thrown.