|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.asn1.ber.digester.AbstractRule
org.apache.asn1.ber.digester.rules.PrimitiveBooleanRule
public class PrimitiveBooleanRule
A rule to Decode a BER encoded ASN.1 INTEGER into a Java primitive int.
The bytes to form the integer are extracted from the BER value which may arrive in multiple chunks. The individual bytes are temporarily stored within a 4 byte array while incrementing a counter to track the capture. Once gathered the bytes are decoded into a int in the finish
As a side effect once the decode is complete, the primitive value is pushed onto the primitive int stack to be utilized by other rules later. If there is a loss of precision where the ASN.1 INTEGER is larger or smaller than the maximum or minimum value of a Java primitive integer an exception is thrown.
| Field Summary | |
|---|---|
private boolean |
octetSet
boolean flag to determine if we have read the single octet |
private TagEnum |
tag
the tag this rule accepts |
private byte |
value
the octet for the Java primitive boolean |
| Constructor Summary | |
|---|---|
PrimitiveBooleanRule()
Creates a default primitive boolean decoding rule that only accepts tags of UniversalTag.BOOLEAN. |
|
PrimitiveBooleanRule(TagEnum tag)
Creates a default primitive integer decoding rule that only accepts tags of UniversalTag.INTEGER. |
|
| Method Summary | |
|---|---|
void |
finish()
Called when the tlv has been completely consumed. |
void |
length(int length)
Called when the length of a TLV is encountered. |
void |
tag(int id,
boolean isPrimitive,
TypeClass typeClass)
Called when the tag of the matched TLV is encountered. |
void |
value(java.nio.ByteBuffer buf)
Called when a peice of the value is available. |
| Methods inherited from class org.apache.asn1.ber.digester.AbstractRule |
|---|
getDigester, setDigester |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private byte value
private boolean octetSet
private final TagEnum tag
| Constructor Detail |
|---|
public PrimitiveBooleanRule()
public PrimitiveBooleanRule(TagEnum tag)
| Method Detail |
|---|
public void tag(int id,
boolean isPrimitive,
TypeClass typeClass)
Rule
tag in interface Ruletag in class AbstractRuleid - the tag's idisPrimitive - whether tlv is primitive or constructedtypeClass - the tag's type classpublic void length(int length)
Rule
length in interface Rulelength in class AbstractRulelength - the length in bytes of the valuepublic void value(java.nio.ByteBuffer buf)
Rule
value in interface Rulevalue in class AbstractRulebuf - a portion of the valuepublic void finish()
Rule
finish in interface Rulefinish in class AbstractRule
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||