Asn1DecodeBitBuffer Class Reference
Public Member Functions | |
Asn1DecodeBitBuffer (System.IO.Stream istream) | |
Asn1DecodeBitBuffer (byte[] msgdata) | |
virtual void | ByteAlign () |
virtual bool | DecodeBit () |
virtual int | DecodeBitsToInt (int nbits) |
virtual long | DecodeBitsToLong (int nbits) |
virtual void | DecodeBitsToOctetArray (byte[] data, int offset, int bitOffset, int nbits) |
virtual void | DecodeBitsToOctetArray (byte[] data, int offset, int nbits) |
void | MoveBitCursor (long offset) |
sealed override int | ReadByte () |
sealed override void | SetInputStream (byte[] msgdata, int offset, int length) |
Properties | |
virtual long | BitOffset [get] |
virtual int | MsgBitCnt [get] |
Detailed Description
This class handles decoding where the decode buffer is viewed as a set of bits (i.e. a bit offset is maintained).
Constructor & Destructor Documentation
Asn1DecodeBitBuffer | ( | byte[] | msgdata | ) |
This constructor creates a Decode buffer object that references an encoded ASN.1 message.
- Parameters:
-
msgdata Byte array containing an encoded ASN.1 message.
Asn1DecodeBitBuffer | ( | System.IO.Stream | istream | ) |
This constructor creates a Decode buffer object that references an encoded ASN.1 message. In this case, the message is passed in using an System.IO.Stream object.
- Parameters:
-
istream Input stream containing an encoded ASN.1 message.
Member Function Documentation
virtual void ByteAlign | ( | ) | [virtual] |
This methods byte-aligns the buffer.
Reimplemented in Asn1PerDecodeBuffer.
virtual bool DecodeBit | ( | ) | [virtual] |
This method decodes a single bit value.
- Returns:
- Boolean value of bit that was decoded.
Reimplemented in Asn1PerDecodeBuffer.
virtual int DecodeBitsToInt | ( | int | nbits | ) | [virtual] |
This method decodes bits from the input stream into a standard integer value. Up to 32 bits can be decoded. The bits are placed in the least-significant bytes of the integer.
- Parameters:
-
nbits Number of bits to Decode
- Returns:
- Integer value containing decoded bits
Reimplemented in Asn1PerDecodeBuffer.
virtual long DecodeBitsToLong | ( | int | nbits | ) | [virtual] |
This method decodes bits from the input stream into a long integer value. Up to 64 bits can be decoded. The bits are placed in the least-significant bytes of the long integer.
- Returns:
- Long integer value containing decoded bits
- Parameters:
-
nbits Number of bits to Decode
Reimplemented in Asn1PerDecodeBuffer.
virtual void DecodeBitsToOctetArray | ( | byte[] | data, | |
int | offset, | |||
int | bitOffset, | |||
int | nbits | |||
) | [virtual] |
This method decodes bits from the input stream into an array of octets. The user is expected to have provided an array large enough to hold the number of bits requested to be decoded.
The first bit is decoded into the given offset byte at the MSB if bitOffset == 0, and at the LSB if bitOffset == 7.
- Parameters:
-
data Octet array for decoded data offset Starting byte offset into array bitOffset Where in first byte the first bit goes nbits Number of bits to Decode
virtual void DecodeBitsToOctetArray | ( | byte[] | data, | |
int | offset, | |||
int | nbits | |||
) | [virtual] |
This method decodes bits from the input stream into an array of octets. The user is expected to have provided an array large enough to hold the number of bits requested to be decoded.
- Parameters:
-
data Octet array for decoded data offset Starting byte offset into array nbits Number of bits to Decode
Reimplemented in Asn1PerDecodeBuffer.
void MoveBitCursor | ( | long | offset | ) |
This method moves the bit cursor to the given offset.
- Parameters:
-
offset Absolute bit offset value
sealed override int ReadByte | ( | ) | [virtual] |
This method returns the next available 8-bit value from the input stream. It is implemented differently for BER/DER and PER to take into account odd alignments in PER.
- Returns:
- Next 8-bit byte value from input stream
Implements Asn1DecodeBuffer.
sealed override void SetInputStream | ( | byte[] | msgdata, | |
int | offset, | |||
int | length | |||
) | [virtual] |
This method will set the input stream from which data is read. This version of the method allows a byte array containing encoded data to be specified.
- Parameters:
-
msgdata Byte array containing encoded message data offset Starting offset of data in the byte array length Length (in bytes) of the encoded data
Reimplemented from Asn1DecodeBuffer.
Property Documentation
virtual long BitOffset [get] |
Gets the absolute offset to the current bit in the Decode buffer.
Value:
offset to current bit in Decode buffer
virtual int MsgBitCnt [get] |
Gets the number of bits in the encoded message.
Value:
count of bits in encoded message