Asn1EncodeBuffer Class Reference

Inheritance diagram for Asn1EncodeBuffer:
Asn1MessageBuffer Asn1MessageBufferBase

List of all members.

Public Member Functions

abstract void BinDump (System.IO.StreamWriter outs, System.String varName)
virtual void BinDump (System.String varName)
abstract void Copy (byte[] value, int offset, int len)
void Copy (byte[] value)
abstract void Copy (byte value)
override Stream GetInputStream ()
Stream GetOutputStream ()
virtual void HexDump (System.IO.StreamWriter outs)
virtual void HexDump ()
abstract void Reset ()
abstract void Write (System.IO.Stream outs)

Static Public Member Functions

static int EncodeIntSigned (long value, byte[] dest, int offset)
static int EncodeIntUnsigned (long value, byte[] dest, int offset)
static int GetMinimalOctetsSigned (long value)
static int GetMinimalOctetsUnsigned (long value)

Public Attributes

const int SIZE_INCREMENT = 1024

Protected Attributes

internal int mSizeIncrement

Properties

abstract System.IO.MemoryStream ByteArrayInputStream [get]
abstract byte[] MsgCopy [get]
abstract int MsgLength [get]

Detailed Description

This is the base class to specific encode buffer classes for the different types of encoding rules (BER, DER and PER).


Member Function Documentation

abstract void BinDump ( System.IO.StreamWriter  outs,
System.String  varName 
) [pure virtual]

This method dumps the encoded message in a human-readable format showing a bit trace of all fields to the given print output stream.

Parameters:
outs Output will be written to this stream
varName Name of the Decoded ASN1 Type

Implemented in Asn1BerEncodeBuffer, Asn1OerEncodeBuffer, Asn1PerEncodeBuffer, Asn1XerEncodeBuffer, and Asn1XmlEncodeBuffer.

virtual void BinDump ( System.String  varName  )  [virtual]

This method invokes an overloaded version of BinDump to dump the encoded message to standard output.

Parameters:
varName Name of the Decoded ASN1 Type
abstract void Copy ( byte[]  value,
int  offset,
int  len 
) [pure virtual]

This method copies multiple bytes from the given array to the encode buffer.

Parameters:
value Array of bytes to copy to the encode buffer
offset The first byte copied is value[offset]
len The last byte copied is value[offset + len - 1]
void Copy ( byte[]  value  ) 

This method copies multiple bytes to the encode buffer

Parameters:
value Array of bytes to copy to the encode buffer
abstract void Copy ( byte  value  )  [pure virtual]

This abstract method is used to copy a single byte to the encode buffer.

Parameters:
value The byte value to copy
static int EncodeIntSigned ( long  value,
byte[]  dest,
int  offset 
) [static]

Encode an integer value as a signed value (2's complement), in the minimum number of octets possible (>=1), into the given array. /p>

Parameters:
value The value to encode.
dest The array to but the encoding into. It must be large enough to hold the result, taking into account the given offset.
offset The index where the first byte should go.
Returns:
The number of bytes.
static int EncodeIntUnsigned ( long  value,
byte[]  dest,
int  offset 
) [static]

Encode an integer value as an unsigned value (binary integer), in the minimum number of octets possible (>=1), into the given array.

Parameters:
value The value to encode. It must be non-negative.
dest The array to but the encoding into. It must be large enough to hold the result, taking into account the given offset.
offset The index where the first byte should go.
Returns:
The number of bytes.
override Stream GetInputStream (  )  [virtual]

This method returns an input stream representing the encoded message.

Returns:
Input stream containing encoded message

Implements Asn1MessageBuffer.

static int GetMinimalOctetsSigned ( long  value  )  [static]

Return the minimal number of octets required to represent the given value, when a signed representation is being used.

Returns:
The number of octets, <= 8.
static int GetMinimalOctetsUnsigned ( long  value  )  [static]

Return the minimal number of octets required to represent the given value, when an unsigned representation is being used.

Parameters:
value Must be >=0
Returns:
The number of octets, <= 8.
Stream GetOutputStream (  ) 

Return an output stream associated with this object. Anything written to the Stream will be written to this buffer using copy(byte) or copy(byte[]).

virtual void HexDump ( System.IO.StreamWriter  outs  )  [virtual]

This method dumps the encoded message in hex/ascii format to the given print output stream.

Parameters:
outs Output stream object reference
virtual void HexDump (  )  [virtual]

This method dumps the encoded message in hex/ascii format to the standard output stream.

Reimplemented in Asn1PerEncodeBuffer.

abstract void Reset (  )  [pure virtual]

This method resets the buffer to allow a new record to be encoded into it. Any previously encoded data is lost.

Implemented in Asn1PerEncodeBuffer.

abstract void Write ( System.IO.Stream  outs  )  [pure virtual]

This method writes the encoded record to the given output stream.

Parameters:
outs Output stream to which record is to be written

Member Data Documentation

internal int mSizeIncrement [protected]

This variable holds the user defined buffer increament size. It defines intial size and size it will be incremented by each time the buffer expands.

const int SIZE_INCREMENT = 1024

This constant specifies the default size of the encode buffer and size it will be incremented by each time the buffer expands. It is currently set to 1024 bytes.


Property Documentation

abstract System.IO.MemoryStream ByteArrayInputStream [get]

Gets a reference to a MemoryStream representing the encoded message. This is the preferred way to access the contents of the encoded message as it is the most efficient (it does not make a copy of the message).

Value: MemoryStream containing encoded message

abstract byte [] MsgCopy [get]

Gets the encoded message in a byte array. This is less efficient than the GetInputStream method because the message contents must be copied to a newly created byte array.

Value: byte array containing encoded message

abstract int MsgLength [get]

Gets the length (in bytes) of the encoded message component.

Value: length of encoded message component