|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.asn1.codec.stateful.AbstractStatefulDecoder
org.apache.asn1.ber.digester.BERDigester
A special BER TLV event rulesBase. This class was inspired by the XML rulesBase in Jakarta Commons.
Nested Class Summary | |
(package private) class |
BERDigester.DigesterCallback
|
Field Summary | |
private org.apache.commons.collections.primitives.BooleanStack |
booleanStack
the primitive boolean stack where rules push and pop booleans |
private org.apache.commons.collections.primitives.ByteStack |
byteStack
the primitive byte stack where rules push and pop bytes |
private org.apache.commons.collections.primitives.CharStack |
charStack
the primitive char stack where rules push and pop chars |
private java.lang.ClassLoader |
classLoader
The class loader to use for instantiating application objects. |
private BERDecoder |
decoder
the underlying decoder used by this rulesBase |
private org.apache.commons.collections.primitives.DoubleStack |
doubleStack
the primitive double stack where rules push and pop doubles |
private org.apache.commons.collections.primitives.FloatStack |
floatStack
the primitive float stack where rules push and pop floats |
private org.apache.commons.collections.primitives.IntStack |
intStack
the primitive int stack where rules push and pop ints |
private org.apache.commons.collections.primitives.LongStack |
longStack
the primitive long stack where rules push and pop longs |
private java.util.List |
matched
the currently matched rules |
private BERDigesterMonitor |
monitor
The monitor used by this digester |
static int |
NO_TOP_TAG
For now this corresponds to a tag of class Universal with an id of 15. |
private org.apache.commons.collections.ArrayStack |
objectStack
the object stack where rules push and pop ASN.1 POJO stubs |
private java.lang.Object |
root
The "root" element of the stack (in other words, the last object that was popped. |
private Rules |
rules
the rules base used by this digester |
private org.apache.commons.collections.primitives.ShortStack |
shortStack
the primitive short stack where rules push and shorts |
private org.apache.commons.collections.primitives.IntStack |
tagStack
the tag stack used to store the nesting pattern |
private boolean |
useContextClassLoader
Do we want to use the Context ClassLoader when loading classes for instantiating new objects. |
Fields inherited from class org.apache.asn1.codec.stateful.AbstractStatefulDecoder |
|
Constructor Summary | |
BERDigester()
Creates a BER TLV event rulesBase. |
Method Summary | |
void |
addRule(int[] pattern,
Rule rule)
Register a new Rule matching the specified pattern. |
void |
clear()
Clear the current contents of the object stack. |
void |
decode(java.lang.Object encoded)
|
(package private) void |
fireFinishEvent()
|
(package private) void |
fireLengthEvent(int length)
|
(package private) void |
fireTagEvent(int id,
boolean isPrimitive,
TypeClass typeClass)
|
(package private) void |
fireValueEvent(java.nio.ByteBuffer buf)
|
int |
getBooleanCount()
Return the current depth of the boolean stack. |
int |
getByteCount()
Return the current depth of the byte stack. |
int |
getCharCount()
Return the current depth of the char stack. |
java.lang.ClassLoader |
getClassLoader()
Return the class loader to be used for instantiating application objects when required. |
int |
getCount()
Return the current depth of the object stack. |
int |
getDoubleCount()
Return the current depth of the double stack. |
int |
getFloatCount()
Return the current depth of the float stack. |
int |
getIntCount()
Return the current depth of the int stack. |
int |
getLongCount()
Return the current depth of the long stack. |
java.lang.Object |
getRoot()
This method allows you to access the root object that has been created after decoding. |
Rules |
getRules()
Return the Rules implementation object containing our rules collection and associated matching policy. |
int |
getShortCount()
Return the current depth of the short stack. |
int |
getTag(int n)
Return the n'th tag down the Tag stack, where 0 is the top element and [getCount()-1] is the bottom element. |
int |
getTagCount()
Return the current depth of the Tag stack. |
int |
getTopTag()
Gets the raw int for the tag of the TLV currently being processed hence the tag on the top of the stack. |
boolean |
getUseContextClassLoader()
Return the boolean as to whether the context classloader should be used. |
java.lang.Object |
peek()
Return the top object on the stack without removing it. |
java.lang.Object |
peek(int n)
Return the n'th object down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
boolean |
peekBoolean()
Return the top boolean on the stack without removing it. |
boolean |
peekBoolean(int n)
Return the n'th boolean down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
byte |
peekByte()
Return the top byte on the stack without removing it. |
byte |
peekByte(int n)
Return the n'th byte down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
char |
peekChar()
Return the top char on the stack without removing it. |
char |
peekChar(int n)
Return the n'th char down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
double |
peekDouble()
Return the top double on the stack without removing it. |
double |
peekDouble(int n)
Return the n'th double down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
float |
peekFloat()
Return the top float on the stack without removing it. |
float |
peekFloat(int n)
Return the n'th float down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
int |
peekInt()
Return the top int on the stack without removing it. |
int |
peekInt(int n)
Return the n'th int down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
long |
peekLong()
Return the top long on the stack without removing it. |
long |
peekLong(int n)
Return the n'th long down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
short |
peekShort()
Return the top short on the stack without removing it. |
short |
peekShort(int n)
Return the n'th short down the stack, where 0 is the top element and [getCount()-1] is the bottom element. |
java.lang.Object |
pop()
Pop the top object off of the stack, and return it. |
boolean |
popBoolean()
Pop the top boolean off of the stack, and return it. |
byte |
popByte()
Pop the top byte off of the stack, and return it. |
char |
popChar()
Pop the top char off of the stack, and return it. |
double |
popDouble()
Pop the top double off of the stack, and return it. |
float |
popFloat()
Pop the top float off of the stack, and return it. |
int |
popInt()
Pop the top int off of the stack, and return it. |
long |
popLong()
Pop the top long off of the stack, and return it. |
short |
popShort()
Pop the top short off of the stack, and return it. |
void |
push(java.lang.Object object)
Push a new object onto the top of the object stack. |
void |
pushBoolean(boolean bit)
Push a new boolean onto the top of the boolean stack. |
void |
pushByte(byte bite)
Push a new byte onto the top of the byte stack. |
void |
pushChar(char ch)
Push a new char onto the top of the char stack. |
void |
pushDouble(double element)
Push a new double onto the top of the double stack. |
void |
pushFloat(float element)
Push a new float onto the top of the float stack. |
void |
pushInt(int element)
Push a new int onto the top of the int stack. |
void |
pushLong(long element)
Push a new long onto the top of the long stack. |
void |
pushShort(short element)
Push a new short onto the top of the short stack. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader to be used for instantiating application objects when required. |
void |
setRules(Rules rules)
Set the Rules implementation object containing our rules collection and associated matching policy. |
void |
setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader() )
to resolve/load classes that are defined in various rules. |
Methods inherited from class org.apache.asn1.codec.stateful.AbstractStatefulDecoder |
decodeOccurred, getDecoderMonitor, setCallback, setDecoderMonitor |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NO_TOP_TAG
private BERDecoder decoder
private org.apache.commons.collections.ArrayStack objectStack
private org.apache.commons.collections.primitives.BooleanStack booleanStack
private org.apache.commons.collections.primitives.CharStack charStack
private org.apache.commons.collections.primitives.FloatStack floatStack
private org.apache.commons.collections.primitives.DoubleStack doubleStack
private org.apache.commons.collections.primitives.IntStack intStack
private org.apache.commons.collections.primitives.ByteStack byteStack
private org.apache.commons.collections.primitives.LongStack longStack
private org.apache.commons.collections.primitives.ShortStack shortStack
private org.apache.commons.collections.primitives.IntStack tagStack
private Rules rules
private java.util.List matched
private java.lang.ClassLoader classLoader
useContextClassLoader
variable.
private boolean useContextClassLoader
false
.
private java.lang.Object root
private BERDigesterMonitor monitor
Constructor Detail |
public BERDigester()
Method Detail |
public void decode(java.lang.Object encoded) throws org.apache.asn1.codec.DecoderException
org.apache.asn1.codec.DecoderException
public void addRule(int[] pattern, Rule rule)
Rule
matching the specified pattern.
pattern
- tag nesting patternrule
- the Rule to add to this BERDigesterpublic Rules getRules()
public void clear()
public int getCount()
public java.lang.Object peek()
java.util.EmptyStackException
- if there are no objects on the stackpublic java.lang.Object peek(int n)
n
- the element index
java.util.EmptyStackException
- if there are no objects on the stack
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic java.lang.Object pop()
java.util.EmptyStackException
- if there are no objects on the stackpublic void push(java.lang.Object object)
object
- the object to push onto the stackpublic int getBooleanCount()
public boolean peekBoolean()
java.util.EmptyStackException
- if there are no more boolean elements leftpublic boolean peekBoolean(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more boolean elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic boolean popBoolean()
java.util.EmptyStackException
- if the stack is emptypublic void pushBoolean(boolean bit)
bit
- the boolean to push onto the stackpublic int getCharCount()
public char peekChar()
java.util.EmptyStackException
- if there are no more char elements leftpublic char peekChar(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more char elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic char popChar()
java.util.EmptyStackException
- if the stack is emptypublic void pushChar(char ch)
ch
- the char to push onto the stackpublic int getByteCount()
public byte peekByte()
java.util.EmptyStackException
- if there are no more byte elements leftpublic byte peekByte(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more byte elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic byte popByte()
java.util.EmptyStackException
- if the stack is emptypublic void pushByte(byte bite)
bite
- the byte to push onto the stackpublic int getShortCount()
public short peekShort()
java.util.EmptyStackException
- if there are no more short elements leftpublic short peekShort(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more short elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic short popShort()
java.util.EmptyStackException
- if the stack is emptypublic void pushShort(short element)
element
- the short to push onto the stackpublic int getIntCount()
public int peekInt()
java.util.EmptyStackException
- if there are no more int elements leftpublic int peekInt(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more int elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic int popInt()
java.util.EmptyStackException
- if the stack is emptypublic void pushInt(int element)
element
- the int to push onto the stackpublic int getLongCount()
public long peekLong()
java.util.EmptyStackException
- if there are no more long elements leftpublic long peekLong(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more long elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic long popLong()
java.util.EmptyStackException
- if the stack is emptypublic void pushLong(long element)
element
- the long to push onto the stackpublic int getFloatCount()
public float peekFloat()
java.util.EmptyStackException
- if there are no more float elements leftpublic float peekFloat(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more float elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic float popFloat()
java.util.EmptyStackException
- if the stack is emptypublic void pushFloat(float element)
element
- the float to push onto the stackpublic int getDoubleCount()
public double peekDouble()
java.util.EmptyStackException
- if there are no more double elements leftpublic double peekDouble(int n)
n
- the element index
java.util.EmptyStackException
- if there are no more double elements left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic double popDouble()
java.util.EmptyStackException
- if the stack is emptypublic void pushDouble(double element)
element
- the double to push onto the stackpublic java.lang.Object getRoot()
public void setRules(Rules rules)
rules
- the rules to add to this rulesBasepublic int getTagCount()
public int getTag(int n)
n
- the Tag index
java.util.EmptyStackException
- if there are no more int Tags left
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic int getTopTag()
public java.lang.ClassLoader getClassLoader()
setClassLoader()
, if anyuseContextClassLoader
property is set to true
public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The new class loader to use, or null
to revert to the standard rulespublic boolean getUseContextClassLoader()
public void setUseContextClassLoader(boolean use)
Thread.currentThread().getContextClassLoader()
)
to resolve/load classes that are defined in various rules. If not
using Context ClassLoader, then the class-loading defaults to
using the calling-class' ClassLoader.
use
- determines whether to use Context ClassLoader.void fireTagEvent(int id, boolean isPrimitive, TypeClass typeClass)
void fireLengthEvent(int length)
void fireValueEvent(java.nio.ByteBuffer buf)
void fireFinishEvent()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |