public class Asn1BerDecodeBuffer extends Asn1DecodeBuffer
mByteCountcontext, mTypeCode| Constructor and Description |
|---|
Asn1BerDecodeBuffer(byte[] msgdata)
This constructor creates a BER decode buffer object that
references an encoded ASN.1 message.
|
Asn1BerDecodeBuffer(java.io.InputStream istream)
This constructor creates a BER decode buffer object that
references an encoded ASN.1 message.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
calcIndefLen(byte[] data,
int offset,
int len)
This function calculates the actual length of an indefinite length
message component.
|
int |
decodeEnumValue(Asn1Tag tag,
boolean explicit,
int implicitLength)
This method decodes an enumerated value from the buffer.
|
int |
decodeEnumValue(boolean explicit,
int implicitLength)
This method decodes an enumerated value from the buffer.
|
int |
decodeLength()
This method decodes a length value.
|
byte[] |
decodeOpenType()
This method decodes an ASN.1 BER open type value.
|
byte[] |
decodeOpenType(boolean saveData)
This method decodes an ASN.1 BER open type value.
|
void |
decodeTag(Asn1Tag tag)
This method decodes a tag value.
|
int |
decodeTagAndLength(Asn1Tag tag)
This method decodes a tag and length value.
|
Asn1Tag |
getLastTag()
This method will return the last tag parsed within this
decode buffer object.
|
java.lang.RuntimeException |
handleException(Asn1Exception e)
If this buffer has an exception handler set, this will return
handler.handleException(e, this).
|
boolean |
matchTag(Asn1Tag tag)
This overloaded version of matchTag will just test for a
match and not return parsed tag and length values
|
boolean |
matchTag(Asn1Tag tag,
Asn1Tag parsedTag,
IntHolder parsedLen)
This overloaded version of matchTag allows the tag value to
be matched to be passed using an Asn1Tag object.
|
boolean |
matchTag(short tagClass,
short tagForm,
int tagIDCode,
Asn1Tag parsedTag,
IntHolder parsedLen)
This method decodes the next tag value and checks for a match
with the given tag value.
|
protected void |
movePastEOC(boolean saveData) |
void |
parse(Asn1TaggedEventHandler handler)
This method parses the complete message and invokes the event
handler callback methods as various items are encountered.
|
Asn1Tag |
peekTag()
This overloaded version of the peekTag method will return a reference
to a newly created tag object.
|
void |
peekTag(Asn1Tag parsedTag)
This method will parse and return the next tag in the decode
stream without advancing the decode cursor.
|
int |
readByte()
This method returns the next available 8-bit value
from the input stream.
|
void |
setExceptionHandler(Asn1BerExceptionHandler handler)
Set an exception handler on this buffer.
|
void |
skipTLV()
This method skips a TLV (tag, length, value) in the encoding.
|
void |
throwIfUnhandled(Asn1Exception e)
Throw the given exception, unless an exception handler is set and it
the handler handles it.
|
addCaptureBuffer, capture, decodeIntValue, decodeOIDContents, decodeOIDContentsBig, decodeRelOIDContents, decodeRelOIDContentsBig, getByteCount, getInputStream, getLazyOpenTypeDecode, hexDump, init, mark, read, read, read, read2Bytes, read4Bytes, removeCaptureBuffer, reset, setInputStream, setLazyOpenTypeDecode, skip, skipOIDContents, skipRelOIDContentsaddNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerListgetContext, hexDump, hexDump, setKey, setTypeCodepublic Asn1BerDecodeBuffer(byte[] msgdata)
msgdata - Byte array containing an encoded ASN.1 message.public Asn1BerDecodeBuffer(java.io.InputStream istream)
istream - Input stream containing an encoded ASN.1 message.public static int calcIndefLen(byte[] data,
int offset,
int len)
throws Asn1Exception,
java.io.IOException
data - Buffer with the indefinite length message component.offset - Offset in the bufferlen - Length of the buffer (begining from the offset)java.io.IOException - for I/O exceptionAsn1Exceptionpublic final int decodeLength()
throws Asn1Exception,
java.io.IOException
java.io.IOException - for I/O exceptionAsn1Exceptionpublic byte[] decodeOpenType()
throws Asn1Exception,
java.io.IOException
java.io.IOException - for I/O exceptionAsn1Exceptionpublic byte[] decodeOpenType(boolean saveData)
throws Asn1Exception,
java.io.IOException
saveData - True if data should be captured and returnedjava.io.IOException - for I/O exceptionAsn1Exceptionprotected final void movePastEOC(boolean saveData)
throws Asn1Exception,
java.io.IOException
Asn1Exceptionjava.io.IOExceptionpublic final void decodeTag(Asn1Tag tag) throws Asn1Exception, java.io.IOException
tag - Tag object to receive decoded tag fields.java.io.IOException - for I/O exceptionAsn1Exceptionpublic final int decodeTagAndLength(Asn1Tag tag) throws Asn1Exception, java.io.IOException
tag - Tag object to receive decoded tag fields.Asn1Exceptionjava.io.IOExceptionpublic Asn1Tag getLastTag()
public final java.lang.RuntimeException handleException(Asn1Exception e)
e - public final boolean matchTag(short tagClass,
short tagForm,
int tagIDCode,
Asn1Tag parsedTag,
IntHolder parsedLen)
throws Asn1Exception,
java.io.IOException
tagClass - Class value of tag to matchtagForm - Form value of tag to matchtagIDCode - ID code of tag to matchparsedTag - Holder object to receive parsed tag valueparsedLen - Holder object to receive parsed length valueAsn1Exceptionjava.io.IOExceptionpublic final boolean matchTag(Asn1Tag tag, Asn1Tag parsedTag, IntHolder parsedLen) throws Asn1Exception, java.io.IOException
tag - Tag value to be matched.parsedTag - Holder object to receive parsed tag valueparsedLen - Holder object to receive parsed length valueAsn1Exceptionjava.io.IOExceptionpublic final boolean matchTag(Asn1Tag tag) throws Asn1Exception, java.io.IOException
tag - Tag value to be matched.Asn1Exceptionjava.io.IOExceptionpublic final void peekTag(Asn1Tag parsedTag) throws Asn1Exception, java.io.IOException
parsedTag - Holder object to receive parsed tag valueAsn1Exceptionjava.io.IOExceptionpublic final Asn1Tag peekTag() throws Asn1Exception, java.io.IOException
Asn1Exceptionjava.io.IOExceptionpublic final void setExceptionHandler(Asn1BerExceptionHandler handler)
handler - Your exception handler or null.public void skipTLV()
throws Asn1Exception,
java.io.IOException
java.io.IOException - for I/O exceptionAsn1Exceptionpublic final void throwIfUnhandled(Asn1Exception e) throws java.lang.RuntimeException
e - The exceptionjava.lang.RuntimeExceptionpublic void parse(Asn1TaggedEventHandler handler) throws Asn1Exception, java.io.IOException
handler - Object implementing the Asn1EventHandler interface.Asn1Exceptionjava.io.IOExceptionpublic int readByte()
throws Asn1Exception,
java.io.IOException
readByte in class Asn1DecodeBufferAsn1Exceptionjava.io.IOExceptionpublic int decodeEnumValue(boolean explicit,
int implicitLength)
throws Asn1Exception,
java.io.IOException
explicit - Flag that indicates element is explicitly tagged.implicitLength - Length of contents if implicit.Asn1Exceptionjava.io.IOExceptionpublic int decodeEnumValue(Asn1Tag tag, boolean explicit, int implicitLength) throws Asn1Exception, java.io.IOException
tag - The tag to match for decoding.explicit - Flag that indicates element is explicitly tagged.implicitLength - Length of contents if implicit.Asn1Exceptionjava.io.IOException