|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objsys.asn1j.runtime.Asn1MessageBufferBase com.objsys.asn1j.runtime.Asn1MessageBuffer com.objsys.asn1j.runtime.Asn1DecodeBuffer com.objsys.asn1j.runtime.Asn1PerDecodeBuffer
public class Asn1PerDecodeBuffer
This class handles the decoding of ASN.1 messages as specified in the Packed Encoding Rules (PER) as specified in the ITU-T X.691 standard.
Field Summary | |
---|---|
protected Asn1PerTraceHandler |
mTraceHandler
|
Fields inherited from class com.objsys.asn1j.runtime.Asn1DecodeBuffer |
---|
mByteCount |
Fields inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
context, mTypeCode |
Constructor Summary | |
---|---|
Asn1PerDecodeBuffer(byte[] msgdata,
boolean aligned)
This constructor creates a PER decode buffer object that references an encoded ASN.1 message. |
|
Asn1PerDecodeBuffer(java.io.InputStream istream,
boolean aligned)
This constructor creates a PER decode buffer object that references an encoded ASN.1 message. |
Method Summary | |
---|---|
void |
binDump(java.io.PrintStream out,
java.lang.String varName)
This method dumps the encoded message in a human-readable format showing a bit trace of all fields to the given print output stream. |
void |
binDump(java.lang.String varName)
This method invokes an overloaded version of binDump to dump the encoded message to standard output. |
void |
byteAlign()
This methods byte-aligns the buffer. |
boolean |
decodeBit()
This method decodes a single bit value. |
boolean |
decodeBit(java.lang.String ident)
This method decodes a single bit value. |
int |
decodeBitsToInt(int nbits)
This method decodes bits from the input stream into a standard integer value. |
int |
decodeBitsToInt(int nbits,
java.lang.String ident)
This method decodes bits from the input stream into a standard integer value. |
long |
decodeBitsToLong(int nbits)
This method decodes bits from the input stream into a long integer value. |
long |
decodeBitsToLong(int nbits,
java.lang.String ident)
This method decodes bits from the input stream into a long integer value. |
void |
decodeBitsToOctetArray(byte[] value,
int offset,
int nbits)
This method decodes bits from the input stream into an array of octets. |
void |
decodeBitsToOctetArray(byte[] value,
int offset,
int bitOffset,
int nbits,
java.lang.String ident)
This method decodes bits from the input stream into an array of octets. |
void |
decodeBitsToOctetArray(byte[] value,
int offset,
int nbits,
java.lang.String ident)
This method decodes bits from the input stream into an array of octets. |
void |
decodeCharString(int nchars,
int abpc,
int ubpc,
Asn1CharSet charSet,
java.lang.StringBuffer sbuf)
This method decodes the contents of a known-multiplier character string. |
long |
decodeConsWholeNumber(long rangeValue)
This method implements the rules to decode a constrained whole number as specified in section 10.5 of the X.691 standard. |
long |
decodeConsWholeNumber(long rangeValue,
java.lang.String ident)
This method implements the rules to decode a constrained whole number as specified in section 10.5 of the X.691 standard. |
long |
decodeExtLength()
This method decodes an extension length value. |
long |
decodeInt(int nocts,
boolean signExtend)
This method implements the rules to decode an unconstrained integer value. |
long |
decodeInt(int nocts,
boolean signExtend,
java.lang.String ident)
This method implements the rules to decode an unconstrained integer value. |
long |
decodeLength()
This method decodes a general (unconstrained) length determinant value as described in section 10.9 of the X.691 standard. |
long |
decodeLength(long lower,
long upper)
This method decodes a constrained length determinant value. |
int |
decodeSmallLength()
This method implements the rules to decode a normally small length as specified in section 11.9 of the X.691 standard. |
int |
decodeSmallNonNegWholeNumber()
This method implements the rules to decode a small non-negative whole number as specified in section 10.6 of the X.691 standard. |
long |
getBitOffset()
This method returns the absolute offset to the current bit in the decode buffer. |
int |
getMsgBitCnt()
This method returns the number of bits in the encoded PER message. |
Asn1PerTraceHandler |
getTraceHandler()
This method will return a reference to the internal trace handler object used to trace the bit fields within a PER message. |
boolean |
isAligned()
This method tests if PER alignment is turned on or off. |
void |
moveBitCursor(long offset)
This method moves the bit cursor to the given offset. |
int |
readByte()
This method returns the next available 8-bit value from the input stream. |
void |
setAligned(boolean value)
This method is used to turn PER aligned encoding on or off. |
static Asn1PerDecodeBuffer |
setBuffer(Asn1PerDecodeBuffer buffer,
byte[] msgdata,
boolean aligned)
This method will create or reinitialize a PER decode message buffer object to read data from the given byte array. |
void |
setInputStream(byte[] msgdata,
int offset,
int length)
This method will set the input stream from which data is read. |
Methods inherited from class com.objsys.asn1j.runtime.Asn1DecodeBuffer |
---|
addCaptureBuffer, capture, decodeIntValue, decodeOIDContents, decodeRelOIDContents, getByteCount, getInputStream, getLazyOpenTypeDecode, hexDump, init, mark, read, read, read, read2Bytes, read4Bytes, removeCaptureBuffer, reset, setLazyOpenTypeDecode, skip |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBuffer |
---|
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
getContext, hexDump, hexDump, setKey, setTypeCode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.objsys.asn1j.runtime.Asn1PerMessageBuffer |
---|
getInputStream |
Field Detail |
---|
protected Asn1PerTraceHandler mTraceHandler
Constructor Detail |
---|
public Asn1PerDecodeBuffer(byte[] msgdata, boolean aligned)
msgdata
- Byte array containing an encoded ASN.1 message.aligned
- Boolean specifying PER aligned or unaligned encoding.public Asn1PerDecodeBuffer(java.io.InputStream istream, boolean aligned)
istream
- Input stream containing an encoded ASN.1 message.aligned
- Boolean specifying PER aligned or unaligned encoding.Method Detail |
---|
public void binDump(java.lang.String varName)
varName
- Name of top-level message object variablepublic void binDump(java.io.PrintStream out, java.lang.String varName)
out
- PrintStream object to which output should be writtenvarName
- Name of top-level message object variablepublic void byteAlign()
byteAlign
in interface Asn1PerMessageBuffer
public boolean decodeBit(java.lang.String ident) throws Asn1EndOfBufferException, java.io.IOException
ident
- Bit field identifier name for tracing.
Asn1EndOfBufferException
java.io.IOException
public boolean decodeBit() throws Asn1EndOfBufferException, java.io.IOException
Asn1EndOfBufferException
java.io.IOException
public long decodeBitsToLong(int nbits, java.lang.String ident) throws Asn1Exception, java.io.IOException
nbits
- Number of bits to decodeident
- Bit field identifier name for tracing.
Asn1Exception
java.io.IOException
public long decodeBitsToLong(int nbits) throws Asn1Exception, java.io.IOException
nbits
- Number of bits to decode
Asn1Exception
java.io.IOException
public int decodeBitsToInt(int nbits, java.lang.String ident) throws Asn1Exception, java.io.IOException
nbits
- Number of bits to decodeident
- Bit field identifier name for tracing.
Asn1Exception
java.io.IOException
public int decodeBitsToInt(int nbits) throws Asn1Exception, java.io.IOException
nbits
- Number of bits to decode
Asn1Exception
java.io.IOException
public void decodeBitsToOctetArray(byte[] value, int offset, int nbits, java.lang.String ident) throws Asn1Exception, java.io.IOException
value
- Octet array for decoded dataoffset
- Starting byte offset into arraynbits
- Number of bits to decodeident
- Bit field identifier name for tracing, or null.
Asn1Exception
java.io.IOException
public void decodeBitsToOctetArray(byte[] value, int offset, int bitOffset, int nbits, java.lang.String ident) throws Asn1Exception, java.io.IOException
value
- Octet array for decoded dataoffset
- Starting byte offset into arraybitOffset
- Where in first byte the first bit goesnbits
- Number of bits to decodeident
- Bit field identifier name for tracing, or null.
Asn1Exception
java.io.IOException
public void decodeBitsToOctetArray(byte[] value, int offset, int nbits) throws Asn1Exception, java.io.IOException
value
- Octet array for decoded dataoffset
- Starting byte offset into arraynbits
- Number of bits to decode
Asn1Exception
java.io.IOException
public void decodeCharString(int nchars, int abpc, int ubpc, Asn1CharSet charSet, java.lang.StringBuffer sbuf) throws Asn1Exception, java.io.IOException
nchars
- Number of charactersabpc
- Number of bits per character (aligned)ubpc
- Number of bits per character (unaligned)charSet
- Object representing the permitted alphabet
constraint character set (optional)sbuf
- String buffer to receive decoded result
Asn1Exception
java.io.IOException
public long decodeConsWholeNumber(long rangeValue, java.lang.String ident) throws Asn1Exception, java.io.IOException
rangeValue
- upper - lower + 1. If a negative value is
passed, it will be interpreted as an unsigned
integer. If 0 is given, it will be interpreted
as 2^64.ident
- Tracing identifier
Asn1Exception
java.io.IOException
public long decodeConsWholeNumber(long rangeValue) throws Asn1Exception, java.io.IOException
rangeValue
- upper - lower + 1. If a negative value is
passed, it will be interpreted as an unsigned
integer. If 0 is given, it will be interpreted
as 2^64.
Asn1Exception
java.io.IOException
public long decodeExtLength() throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public long decodeInt(int nocts, boolean signExtend, java.lang.String ident) throws Asn1Exception, java.io.IOException
nocts
- Number of octets to decodesignExtend
- Sign extend resulting value?ident
- Tracing identifier
Asn1Exception
java.io.IOException
public long decodeInt(int nocts, boolean signExtend) throws Asn1Exception, java.io.IOException
nocts
- Number of octets to decodesignExtend
- Sign extend resulting value?
Asn1Exception
java.io.IOException
public long decodeLength() throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public long decodeLength(long lower, long upper) throws Asn1Exception, java.io.IOException
lower
- Lower bound (inclusive) of length value rangeupper
- Upper bound (inclusive) of length value range
Asn1Exception
java.io.IOException
public int decodeSmallLength() throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public int decodeSmallNonNegWholeNumber() throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public long getBitOffset()
public int getMsgBitCnt()
getMsgBitCnt
in interface Asn1PerMessageBuffer
public boolean isAligned()
isAligned
in interface Asn1PerMessageBuffer
public void moveBitCursor(long offset) throws Asn1EndOfBufferException, java.io.IOException
offset
- Absolute bit offset value
Asn1EndOfBufferException
java.io.IOException
public int readByte() throws Asn1Exception, java.io.IOException
readByte
in class Asn1DecodeBuffer
Asn1Exception
java.io.IOException
public void setAligned(boolean value)
value
- Boolean specifying PER aligned (true) or
unaligned encoding (false).public static Asn1PerDecodeBuffer setBuffer(Asn1PerDecodeBuffer buffer, byte[] msgdata, boolean aligned)
buffer
- Existing message buffer objectmsgdata
- Byte array containing message dataaligned
- Boolean specifying PER aligned or unaligned encoding.public void setInputStream(byte[] msgdata, int offset, int length)
setInputStream
in class Asn1DecodeBuffer
msgdata
- Byte array containing encoded message dataoffset
- Starting offset of data in the byte arraylength
- Length (in bytes) of the encoded datapublic Asn1PerTraceHandler getTraceHandler()
getTraceHandler
in interface Asn1PerMessageBuffer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |