Asn1XerEncodeBuffer Class Reference

Inheritance diagram for Asn1XerEncodeBuffer:
Asn1EncodeBuffer Asn1XerEncoder Asn1MessageBuffer Asn1XmlXerEncoder

List of all members.

Public Member Functions

 Asn1XerEncodeBuffer (bool canonical, int sizeIncrement)
 Asn1XerEncodeBuffer (bool canonical)
 Asn1XerEncodeBuffer ()
override void BinDump (System.IO.StreamWriter outs, System.String varName)
virtual void Copy (System.String data)
virtual void Copy (byte[] data, int off, int len)
override void Copy (byte[] data)
override void Copy (byte data)
virtual void DecrLevel ()
virtual void EncodeBinStrValue (byte[] bits, int nbits)
virtual void EncodeByte (byte data)
virtual void EncodeData (System.String data)
virtual void EncodeEmptyElement (System.String elemName)
virtual void EncodeEndDocument ()
virtual void EncodeEndElement (System.String elemName)
virtual void EncodeHexStrValue (byte[] data)
virtual void EncodeNamedValue (System.String valueName, System.String elemName)
virtual void EncodeNamedValueElement (System.String elemName)
virtual void EncodeObjectId (int[] data)
virtual void EncodeRealValue (double data, System.String elemName)
virtual void EncodeStartDocument ()
virtual void EncodeStartElement (System.String elemName)
override System.IO.Stream GetInputStream ()
virtual void IncrLevel ()
virtual void Indent ()
override void Reset ()
override void Write (System.IO.Stream outs)

Protected Member Functions

internal override void CheckSize (int bytesRequired)

Properties

virtual byte[] Buffer [get]
virtual bool Canonical [set]
override byte[] MsgCopy [get]
override int MsgLength [get]
virtual int State [get, set]

Detailed Description

This class handles the encoding of ASN.1 messages as specified in the XML Encoding Rules (XER) as specified in the ITU-T X.693 standard.


Constructor & Destructor Documentation

The default constructor creates an XER encode buffer object with the default size increment and canonical set to false.

Asn1XerEncodeBuffer ( bool  canonical  ) 

The parameterized constructor creates an XER encode buffer object with default size increment and canonical set to the given values.

Parameters:
canonical Boolean indicating a canonical or non-canonical encoding should be produced as defined in the X.693 standard.
Asn1XerEncodeBuffer ( bool  canonical,
int  sizeIncrement 
)

The parameterized constructor creates an XER encode buffer object with size increment and canonical set to the given values.

Parameters:
canonical Boolean indicating a canonical or non-canonical encoding should be produced as defined in the X.693 standard.
sizeIncrement The initial size in bytes of an encode buffer. If the buffer becomes full, it will be expanded by the amount. If this parameter is set to zero, the default increment will be used.

Member Function Documentation

override void BinDump ( System.IO.StreamWriter  outs,
System.String  varName 
) [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

Implements Asn1EncodeBuffer.

internal override void CheckSize ( int  bytesRequired  )  [protected, virtual]

This method determines if the encode buffer can hold the requested number of bytes. If not, the buffer is expanded.

Parameters:
bytesRequired Number of required bytes.

Reimplemented from Asn1EncodeBuffer.

virtual void Copy ( System.String  data  )  [virtual]

This method copies a character string to the encode buffer.

Parameters:
data The string value to copy

Implements Asn1XmlXerEncoder.

virtual void Copy ( byte[]  data,
int  off,
int  len 
) [virtual]

This method copies multiple bytes to the encode buffer. It is assumed the byte are already formatted into a valid XML encoding type (for example, UTF-8).

Parameters:
data Array of bytes to copy to the encode buffer
off The offset in array at which to begin copy.
len The number of bytes to copy

Implements Asn1XmlXerEncoder.

override void Copy ( byte[]  data  )  [virtual]

This method copies multiple bytes to the encode buffer. It is assumed the byte are already formatted into a valid XML encoding type (for example, UTF-8).

Parameters:
data Array of bytes to copy to the encode buffer

Implements Asn1EncodeBuffer.

override void Copy ( byte  data  )  [virtual]

This method is used to copy a single byte to the encode buffer. It first converts the byte to a hex character representation and then copies it to the output buffer.

Parameters:
data The byte value to copy

Implements Asn1EncodeBuffer.

virtual void DecrLevel (  )  [virtual]

This method decrements the element nesting level counter.

Implements Asn1XmlXerEncoder.

virtual void EncodeBinStrValue ( byte[]  bits,
int  nbits 
) [virtual]

This method encodes XML binary string data

Parameters:
bits Bit String to encode
nbits Number of bits to encode

Implements Asn1XmlXerEncoder.

virtual void EncodeByte ( byte  data  )  [virtual]

This method is used to encode a single byte to the encode buffer. It first converts the byte to a hex character representation and then copies it to the output buffer.

Parameters:
data The byte value to copy

Implements Asn1XmlXerEncoder.

virtual void EncodeData ( System.String  data  )  [virtual]

This method encodes XML string data

Parameters:
data String value to encode

Implements Asn1XmlXerEncoder.

virtual void EncodeEmptyElement ( System.String  elemName  )  [virtual]

This method encodes an XML empty element tag

Parameters:
elemName The name of element.

Implements Asn1XerEncoder.

virtual void EncodeEndDocument (  )  [virtual]

This method encodes standard trailor information at the end of the XML document.

Implements Asn1XmlXerEncoder.

virtual void EncodeEndElement ( System.String  elemName  )  [virtual]

This method encodes an XML end element tag

Parameters:
elemName The name of element.

Implements Asn1XerEncoder.

virtual void EncodeHexStrValue ( byte[]  data  )  [virtual]

This method encodes XML hexadecimal string data

Parameters:
data Data to encode

Implements Asn1XmlXerEncoder.

virtual void EncodeNamedValue ( System.String  valueName,
System.String  elemName 
) [virtual]

This method encodes an XML named value (with start and end tags)

Parameters:
elemName The name of element.
valueName named value.

Implements Asn1XerEncoder.

virtual void EncodeNamedValueElement ( System.String  elemName  )  [virtual]

This method encodes an XML named value element tag

Parameters:
elemName The name of element.
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1XmlXerEncoder.

virtual void EncodeObjectId ( int[]  data  )  [virtual]

This method encodes XML Object Identifiers and Relative OIDs data

Parameters:
data Object's identificators to encode

Implements Asn1XmlXerEncoder.

virtual void EncodeRealValue ( double  data,
System.String  elemName 
) [virtual]

This method encodes an XML REAL (double) value (with start and end tags).

Parameters:
data The value to be encoded.
elemName The name of element. If null, then start and end tags won't be encoded.
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1XerEncoder.

virtual void EncodeStartDocument (  )  [virtual]

This method encodes standard header information at the beginning of the XML document.

Implements Asn1XmlXerEncoder.

virtual void EncodeStartElement ( System.String  elemName  )  [virtual]

This method encodes an XML start element tag

Parameters:
elemName The name of element.

Implements Asn1XerEncoder.

override System.IO.Stream GetInputStream (  )  [virtual]

This method returns an input stream object reference to the message buffer contents (i.e. the encoded data). If an output stream was selected as the output method, this method returns null.

Returns:
Input stream object reference

Implements Asn1MessageBuffer.

virtual void IncrLevel (  )  [virtual]

This method increments the element nesting level counter.

Implements Asn1XmlXerEncoder.

virtual void Indent (  )  [virtual]

This methods indents by adding a new-line followed by whitespace corresponding to the current nesting level to the encode buffer.

Implements Asn1XmlXerEncoder.

override void Reset (  )  [virtual]

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

Implements Asn1EncodeBuffer.

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

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

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

Implements Asn1EncodeBuffer.


Property Documentation

virtual byte [] Buffer [get]

Gets a reference of the byte buffer used to hold the encoded message.

Value: byte array containing encoded message

virtual bool Canonical [set]

Sets the canonical encoding rule.

Value: true if canonical encoding; otherwise false.

override byte [] MsgCopy [get]

Gets the copy of the byte buffer used to hold the encoded message.

Value: byte array containing encoded message

Reimplemented from Asn1EncodeBuffer.

override int MsgLength [get]

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

Value: length of encoded message component

Reimplemented from Asn1EncodeBuffer.

virtual int State [get, set]

Sets the state of the buffer.

Value: buffer stat

Implements Asn1XerEncoder.