ASN1C C# Runtime Library  7.8
Public Member Functions | Properties | List of all members
Asn1XmlOutputStream Class Reference
Inheritance diagram for Asn1XmlOutputStream:
Asn1OutputStream Asn1XmlEncoder Asn1Writable Asn1XmlXerEncoder

Public Member Functions

 Asn1XmlOutputStream (System.IO.Stream os)
 
 Asn1XmlOutputStream (System.IO.Stream os, int bufSize)
 
 Asn1XmlOutputStream (System.IO.Stream os, bool canonical, int bufSize)
 
virtual void Copy (byte data)
 
virtual void Copy (byte[] data)
 
virtual void Copy (byte[] data, int off, int len)
 
virtual void Copy (System.String data)
 
virtual void DecrLevel ()
 
virtual void EncodeAttr (System.String qname, System.String data)
 
virtual void EncodeBinStrValue (byte[] bits, int nbits)
 
virtual void EncodeByte (byte data)
 
virtual void EncodeData (System.String data)
 
virtual void EncodeDoubleValue (double data, System.String elemName, System.String nsPrefix)
 
virtual void EncodeEmptyElement (System.String elemName, System.String nsPrefix, bool terminate)
 
virtual void EncodeEndDocument ()
 
virtual void EncodeEndElement (System.String elemName, System.String nsPrefix)
 
virtual void EncodeEndElement (System.String elemName, System.String nsPrefix, bool indent)
 
virtual void EncodeHexStrValue (byte[] data)
 
virtual void EncodeNamedValue (System.String valueName, System.String elemName, System.String nsPrefix)
 
virtual void EncodeNamedValueElement (System.String valueName)
 
virtual void EncodeStartDocument ()
 
virtual void EncodeStartElement (System.String elemName, System.String nsPrefix, bool terminate)
 
virtual void EncodeXSIAttrs ()
 
virtual void IncrLevel ()
 
virtual void Indent ()
 
virtual bool IsCanonical ()
 
virtual void SetXSIAttrs (Asn1XmlXSIAttrs data)
 
virtual void Write (System.String data)
 
- Public Member Functions inherited from Asn1OutputStream
 Asn1OutputStream (System.IO.Stream os)
 
override void Close ()
 
override void Flush ()
 
override int Read (byte[] buffer, int offset, int count)
 
override long Seek (long offset, System.IO.SeekOrigin origin)
 
override void SetLength (long value)
 
virtual void Write (byte[] b)
 
override void Write (System.Byte[] b, int off, int len)
 
void Write2Bytes (int value)
 
void Write4Bytes (int value)
 
virtual void WriteByte (int b)
 
override void WriteByte (byte b)
 
- Public Member Functions inherited from Asn1Writable
void Write (byte[] b, int off, int len)
 

Properties

virtual bool Canonical [set]
 
virtual Asn1XmlEncodeHelper Helper [get]
 
virtual int State [get, set]
 
- Properties inherited from Asn1OutputStream
override bool CanRead [get]
 
override bool CanSeek [get]
 
override bool CanWrite [get]
 
Asn1Context Context [get]
 
override long Length [get]
 
override long Position [get, set]
 
- Properties inherited from Asn1XmlEncoder
Asn1XmlEncodeHelper Helper [get]
 
int State [get, set]
 
- Properties inherited from Asn1XmlXerEncoder
Asn1Context Context [get]
 

Detailed Description

This class implements the output stream to encode ASN.1 messages as specified in the XML Encoding by the XML schema standard(generated by asn2xsd). A reference to an object of this type is passed to each of the ASN.1 type encode methods involved in encoding a particular message type.

Constructor & Destructor Documentation

◆ Asn1XmlOutputStream() [1/3]

Asn1XmlOutputStream ( System.IO.Stream  os)

This constructor creates a buffered XML output stream object with default size of buffer. Whenever the buffer becomes full, the buffer will be flushed to the stream.

Parameters
osThe underlying System.IO.Stream object.

◆ Asn1XmlOutputStream() [2/3]

Asn1XmlOutputStream ( System.IO.Stream  os,
int  bufSize 
)

This constructor creates a buffered XML output stream object. Whenever the buffer becomes full, the buffer will be flushed to the stream.

Parameters
osThe underlying System.IO.Stream object.
bufSizeThe buffer size. If it is 0 then the output stream is used as unbuffered.

◆ Asn1XmlOutputStream() [3/3]

Asn1XmlOutputStream ( System.IO.Stream  os,
bool  canonical,
int  bufSize 
)

This constructor creates a buffered XML output stream object. Whenever the buffer becomes full, the buffer will be flushed to the stream.

Parameters
osThe underlying System.IO.Stream object.
canonicalBoolean indicating a canonical or non-canonical encoding should be produced as defined in the X.693 standard.
bufSizeThe buffer size. If it is 0 then the output stream is used as unbuffered.

Member Function Documentation

◆ Copy() [1/4]

virtual void Copy ( byte  data)
virtual

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

Parameters
valueThe byte value to copy

<throws> IOException Any exception thrown by the underlying OutputStream. </throws>

Implements Asn1XmlXerEncoder.

◆ Copy() [2/4]

virtual void Copy ( byte []  data)
virtual

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

Parameters
valueArray of bytes to copy to the output stream

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

◆ Copy() [3/4]

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

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

Parameters
valueArray of bytes to copy to the output stream
offStarting offset in array
lenThe length to be encoded

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

◆ Copy() [4/4]

virtual void Copy ( System.String  data)
virtual

This method copies a character string to the output stream.

Parameters
valueThe string value to copy

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

◆ DecrLevel()

virtual void DecrLevel ( )
virtual

This method decrements the element nesting level counter.

Implements Asn1XmlXerEncoder.

◆ EncodeAttr()

virtual void EncodeAttr ( System.String  qname,
System.String  data 
)
virtual

This method encodes an XML attribute value.

Parameters
qnameAttribute qualified name.
valueAttribute value in string form.

Implements Asn1XmlEncoder.

◆ EncodeBinStrValue()

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

This method encodes XML binary string data

Parameters
bitsBit string to encode

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

References Asn1Util.URShift().

◆ EncodeByte()

virtual void EncodeByte ( byte  data)
virtual

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

Parameters
valueThe byte value to copy

<throws> IOException Any exception thrown by the underlying OutputStream. </throws>

Implements Asn1XmlXerEncoder.

References Asn1Util.URShift().

◆ EncodeData()

virtual void EncodeData ( System.String  data)
virtual

This method encodes XML string data

Parameters
valueString value to encode

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

References Asn1XmlUtil.GetXMLString(), and Asn1XmlEncoder_Fields.XMLDATA.

◆ EncodeDoubleValue()

virtual void EncodeDoubleValue ( double  data,
System.String  elemName,
System.String  nsPrefix 
)
virtual

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

Parameters
dataThe value to be encoded.
elemNameThe name of element. If null, then start and end tags won't be encoded.
Exceptions
Asn1ExceptionThrown, if operation is failed.

Implements Asn1XmlEncoder.

References Asn1XmlUtil.EncodeDouble().

◆ EncodeEmptyElement()

virtual void EncodeEmptyElement ( System.String  elemName,
System.String  nsPrefix,
bool  terminate 
)
virtual

This method encodes an XML empty element tag

Parameters
elemNameThe name of element.
nsPrefixThe namespace prefix of element.

<throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlEncoder.

References Asn1XmlEncoder_Fields.XMLEND.

◆ EncodeEndDocument()

virtual void EncodeEndDocument ( )
virtual

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

Implements Asn1XmlXerEncoder.

◆ EncodeEndElement() [1/2]

virtual void EncodeEndElement ( System.String  elemName,
System.String  nsPrefix 
)
virtual

This method encodes an XML end element tag

Parameters
elemNameThe name of element, as String.

Implements Asn1XmlEncoder.

References Asn1XmlEncoder_Fields.XMLEND.

◆ EncodeEndElement() [2/2]

virtual void EncodeEndElement ( System.String  elemName,
System.String  nsPrefix,
bool  indent 
)
virtual

This method encodes an XML end element tag without indenting

Parameters
elemNameThe name of element.

<throws> Asn1Exception Thrown, if operation is failed. </throws>

References Asn1XmlEncoder_Fields.XMLEND.

◆ EncodeHexStrValue()

virtual void EncodeHexStrValue ( byte []  data)
virtual

This method encodes XML hexadecimal string data

Parameters
dataData to encode

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

◆ EncodeNamedValue()

virtual void EncodeNamedValue ( System.String  valueName,
System.String  elemName,
System.String  nsPrefix 
)
virtual

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

Parameters
valueNameThe name of value.
elemNameThe name of element.

<throws> IOException If I/O error occurs. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlEncoder.

◆ EncodeNamedValueElement()

virtual void EncodeNamedValueElement ( System.String  valueName)
virtual

This method encodes an XML named value element tag

Parameters
valueNameThe named value, as String.
Exceptions
Asn1ExceptionThrown, if operation is failed.

Implements Asn1XmlXerEncoder.

References Asn1XmlEncoder_Fields.XMLDATA.

◆ EncodeStartDocument()

virtual void EncodeStartDocument ( )
virtual

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

Implements Asn1XmlXerEncoder.

◆ EncodeStartElement()

virtual void EncodeStartElement ( System.String  elemName,
System.String  nsPrefix,
bool  terminate 
)
virtual

This method encodes an XML start element tag.

Parameters
elemNameThe name of element.
nsPrefixThe namespace prefix of element.

<throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlEncoder.

References Asn1XmlEncoder_Fields.XMLSTART.

◆ EncodeXSIAttrs()

virtual void EncodeXSIAttrs ( )
virtual

This method encodes XSI attributes.

Implements Asn1XmlEncoder.

◆ IncrLevel()

virtual void IncrLevel ( )
virtual

This method increments the element nesting level counter.

Implements Asn1XmlXerEncoder.

◆ Indent()

virtual void Indent ( )
virtual

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

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Implements Asn1XmlXerEncoder.

References Asn1XmlEncoder_Fields.XMLINDENT.

◆ IsCanonical()

virtual bool IsCanonical ( )
virtual

For XER, canonical mode turns off extra whitespace output.

Return true if the encoder has been put into canonical mode. For XML and XER, canonical mode signals the generated encoders to always encode ASN.1 elements that have a DEFAULT value.

Implements Asn1XmlXerEncoder.

◆ SetXSIAttrs()

virtual void SetXSIAttrs ( Asn1XmlXSIAttrs  data)
virtual

This method sets the XSI attributes object to the given value.

Parameters
valueXSI attributes object

Implements Asn1XmlEncoder.

◆ Write()

virtual void Write ( System.String  data)
virtual

This method copies a character string to the output stream.

Parameters
valueThe string value to copy

<throws> IOException Any exception thrown by the underlying OutputStream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

References Asn1Util.WriteStackTrace().

Property Documentation

◆ Canonical

virtual bool Canonical
set

Sets the canonical encoding rule.

Value: true if canonical encoding; otherwise false.

◆ Helper

virtual Asn1XmlEncodeHelper Helper
get

Gets the encoding helper object.

Value: The helper object.

◆ State

virtual int State
getset

Sets the state of the buffer.

Value: buffer stat