|
||||||||||
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.PrimitiveIntDecodeRule
public class PrimitiveIntDecodeRule
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 int |
length
the number of bytes we must read |
private int |
pos
the current 8 bit position to fill in the integer |
private TagEnum |
tag
the tag this rule accepts |
private byte[] |
value
the bytes used to form the Java primitive integer |
Constructor Summary | |
---|---|
PrimitiveIntDecodeRule()
Creates a default primitive integer decoding rule that only accepts tags of UniversalTag.INTEGER. |
|
PrimitiveIntDecodeRule(TagEnum tag)
Creates a default primitive integer decoding rule that only accepts tags of UniversalTag.INTEGER. |
Method Summary | |
---|---|
(package private) boolean |
equals(byte bite,
int ii)
Used for testing to check and see if a value of the byte buffer has been set after a value event. |
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 final byte[] value
private int pos
private int length
private final TagEnum tag
Constructor Detail |
---|
public PrimitiveIntDecodeRule()
public PrimitiveIntDecodeRule(TagEnum tag)
Method Detail |
---|
public void tag(int id, boolean isPrimitive, TypeClass typeClass)
Rule
tag
in interface Rule
tag
in class AbstractRule
id
- the tag's idisPrimitive
- whether tlv is primitive or constructedtypeClass
- the tag's type classpublic void length(int length)
Rule
length
in interface Rule
length
in class AbstractRule
length
- the length in bytes of the valuepublic void value(java.nio.ByteBuffer buf)
Rule
value
in interface Rule
value
in class AbstractRule
buf
- a portion of the valuepublic void finish()
Rule
finish
in interface Rule
finish
in class AbstractRule
boolean equals(byte bite, int ii)
bite
- the byte value to checkii
- the index to check the byte for in the values array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |