public class Asn1PerDecodeBuffer extends Asn1DecodeBuffer implements Asn1PerMessageBuffer
Modifier and Type | Field and Description |
---|---|
protected Asn1PerTraceHandler |
mTraceHandler |
mByteCount
context, mTypeCode
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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 either a constrained or unconstrained
length depending on whether a size constraint object is set
in this object.
|
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 |
decodeUnconsLength()
This method decodes a general (unconstrained) length
determinant value as described in section 10.9 of the 2008
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.
|
void |
setSizeConstraint(long lower,
long upper)
This method is used to set a size constraint within the
buffer object.
|
void |
setSizeConstraintExt(long lower,
long upper,
long extLower,
long extUpper)
This method is used to set an extensible size constraint within
the buffer object.
|
addCaptureBuffer, capture, decodeIntValue, decodeOIDContents, decodeRelOIDContents, getByteCount, getInputStream, getLazyOpenTypeDecode, hexDump, init, mark, read, read, read, read2Bytes, read4Bytes, removeCaptureBuffer, reset, setLazyOpenTypeDecode, skip
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList
getContext, hexDump, hexDump, setKey, setTypeCode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInputStream
protected Asn1PerTraceHandler mTraceHandler
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.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 decodeAsn1Exception
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 decodeAsn1Exception
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 decodeAsn1Exception
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 resultAsn1Exception
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 identifierAsn1Exception
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 identifierAsn1Exception
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 decodeUnconsLength() 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 rangeAsn1Exception
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 valueAsn1EndOfBufferException
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 void setSizeConstraint(long lower, long upper)
lower
- Lower bound of root constraintupper
- Upper bound of root constraintpublic void setSizeConstraintExt(long lower, long upper, long extLower, long extUpper)
lower
- Lower bound of root constraintupper
- Upper bound of root constraintextLower
- Lower bound of extension constraintextUpper
- Upper bound of extension constraintpublic Asn1PerTraceHandler getTraceHandler()
getTraceHandler
in interface Asn1PerMessageBuffer