com.objsys.asn1j.runtime
Class Asn1BerDecodeContext

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

public class Asn1BerDecodeContext
extends java.lang.Object

This class is mainly for internal use by the compiler to keep track of where nested constructed elements (SEQUENCE, SET, CHOICE, etc.) begin and end.


Field Summary
protected  int mDecBufByteCount
          This variable is used to keep track of the current byte count in the decode buffer.
protected  Asn1BerDecodeBuffer mDecodeBuffer
          This variable holds a reference to the BER decode buffer object that is being used to decode the entire message component.
protected  int mElemLength
          This variable holds the contructed element length for the context component.
protected  boolean mExplicitTagging
          This boolean flag variable indictaes if explicit tagging is in effect for this element.
protected  java.util.Vector mTagHistory
          The tag history is a list of decoded tags.
protected  Asn1Tag mTagHolder
          This variable holds the current parsed tag for matching operations.
 
Constructor Summary
Asn1BerDecodeContext(Asn1BerDecodeBuffer decodeBuffer, int elemLength)
          The constructor initializes all internal working varaibles.
 
Method Summary
 void addTag(Asn1Tag tag)
          This method adds a tag to the history.
 boolean expired()
          This method will determine if a decoding context is expired.
 boolean hasDecoded(Asn1Tag tag)
          This method checks to see whether a tag has been already decoded.
 boolean matchElemTag(Asn1Tag tag, IntHolder parsedLen, boolean advance)
          This method will attempt to match the next element tag in a constructed type with the expected value.
 boolean matchElemTag(short tagClass, short tagForm, int tagIDCode, IntHolder parsedLen, boolean advance)
          This method will attempt to match the next element tag in a constructed type with the expected value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mDecodeBuffer

protected Asn1BerDecodeBuffer mDecodeBuffer
This variable holds a reference to the BER decode buffer object that is being used to decode the entire message component.


mDecBufByteCount

protected int mDecBufByteCount
This variable is used to keep track of the current byte count in the decode buffer.


mElemLength

protected int mElemLength
This variable holds the contructed element length for the context component.


mExplicitTagging

protected boolean mExplicitTagging
This boolean flag variable indictaes if explicit tagging is in effect for this element.


mTagHolder

protected Asn1Tag mTagHolder
This variable holds the current parsed tag for matching operations.


mTagHistory

protected java.util.Vector mTagHistory
The tag history is a list of decoded tags. This is used when decoding SETs to ensure that duplicate elements are not encoded.

Constructor Detail

Asn1BerDecodeContext

public Asn1BerDecodeContext(Asn1BerDecodeBuffer decodeBuffer,
                            int elemLength)
The constructor initializes all internal working varaibles.

Parameters:
decodeBuffer - Reference to current decode buffer method.
elemLength - Length of the element being tracked.
Method Detail

expired

public final boolean expired()
                      throws Asn1Exception,
                             java.io.IOException
This method will determine if a decoding context is expired. A context is defined to be the wrapper in which a set of elements or a primitive data type resides..

Returns:
True if at the end of the context block
Throws:
Asn1Exception
java.io.IOException

matchElemTag

public final boolean matchElemTag(short tagClass,
                                  short tagForm,
                                  int tagIDCode,
                                  IntHolder parsedLen,
                                  boolean advance)
                           throws Asn1Exception,
                                  java.io.IOException
This method will attempt to match the next element tag in a constructed type with the expected value. It will check to see if the context is expired and, if not, will match the given tag with the expected tag. The decode cursor is advanced if the boolean advance argument is true.

Parameters:
tagClass - Class value of tag to match
tagForm - Form value of tag to match
tagIDCode - ID code of tag to match
parsedLen - Holder object to receive parsed length value
advance - True if decode cursor to be advanced.
Returns:
True if at the end of the context block
Throws:
Asn1Exception
java.io.IOException

matchElemTag

public final boolean matchElemTag(Asn1Tag tag,
                                  IntHolder parsedLen,
                                  boolean advance)
                           throws Asn1Exception,
                                  java.io.IOException
This method will attempt to match the next element tag in a constructed type with the expected value. It will check to see if the context is expired and, if not, will match the given tag with the expected tag. The decode cursor is advanced if the boolean advance argument is true.

Parameters:
tag - Tag object representing tag to be matched.
parsedLen - Holder object to receive parsed length value
advance - True if decode cursor to be advanced.
Returns:
True if at the end of the context block
Throws:
Asn1Exception
java.io.IOException

addTag

public final void addTag(Asn1Tag tag)
This method adds a tag to the history.

Parameters:
tag - The tag to be added to the history.

hasDecoded

public final boolean hasDecoded(Asn1Tag tag)
This method checks to see whether a tag has been already decoded.

Parameters:
tag - The tag to be searched.
Returns:
True if the tag is in the history.