Asn1OutputStream Class Reference

Inheritance diagram for Asn1OutputStream:
Asn1BerOutputStream Asn1MderOutputStream Asn1PerOutputStream Asn1XerOutputStream Asn1XmlOutputStream Asn1CerOutputStream

List of all members.

Public Member Functions

 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)
override void Write (System.Byte[] b, int off, int len)
virtual void Write (byte[] b)
void Write2Bytes (int value)
void Write4Bytes (int value)
override void WriteByte (byte b)
virtual void WriteByte (int b)

Protected Attributes

internal System.IO.Stream os

Properties

override bool CanRead [get]
override bool CanSeek [get]
override bool CanWrite [get]
Asn1Context Context [get]
override long Length [get]
override long Position [get, set]

Detailed Description

This abstract class implements the base output stream to encode ASN.1 messages.


Constructor & Destructor Documentation

Asn1OutputStream ( System.IO.Stream  os  ) 

This constructor creates an output stream object.

Parameters:
os The underlying System.IO.Stream object.

Member Function Documentation

override void Close (  ) 

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Exceptions:
System.IO.IOException An error occurred while trying to close the stream.

Reimplemented in Asn1PerOutputStream.

override void Flush (  ) 

Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

Exceptions:
System.IO.IOException An I/O error occurs.
System.ObjectDisposedException The stream is closed.

Reimplemented in Asn1PerOutputStream.

override int Read ( byte[]  buffer,
int  offset,
int  count 
)

This method always throws NotSupportedException. Asn1OutputStream doesn't support reading.

Parameters:
buffer When this method returns, contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
offset The byte offset in array at which to begin reading.
count The maximum number of bytes to read.
Returns:
The total number of bytes read into the buffer.
Exceptions:
System.NotSupportedException The stream does not support reading.
override long Seek ( long  offset,
System.IO.SeekOrigin  origin 
)

Sets the current position of this stream to the given value.

Parameters:
offset The point relative to origin from which to begin seeking.
origin Specifies the beginning, the end, or the current position as a reference point for origin, using a value of type SeekOrigin.
Returns:
The new position in the stream.
Exceptions:
System.IO.IOException An I/O error occurs.
System.NotSupportedException The stream does not support seeking, such as if the FileStream is constructed from a pipe or console output.
System.ArgumentException Attempted seeking before the beginning of the stream.
System.ObjectDisposedException Methods were called after the stream was closed.
override void SetLength ( long  value  ) 

Sets the length of this stream to the given value.

Parameters:
value The new length of the stream.
Exceptions:
System.IO.IOException An I/O error has occurred.
System.NotSupportedException The stream does not support both writing and seeking.
System.ArgumentOutOfRangeException Attempted to set the value parameter to less than 0.
override void Write ( System.Byte[]  b,
int  off,
int  len 
)

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters:
b The byte array data to be written.
off The offset in array at which to begin write.
len the number of bytes to write.
Exceptions:
System.ArgumentNullException array is a null reference
System.ArgumentException offset and count describe an invalid range in array.
System.ArgumentOutOfRangeException offset or count is negative.
System.IO.IOException An I/O error occurs.
System.ObjectDisposedException The stream is closed.
System.NotSupportedException The current stream instance does not support writing.

Reimplemented in Asn1PerOutputStream.

virtual void Write ( byte[]  b  )  [virtual]

Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call Write(b, 0, b.length).

Parameters:
b the data.
Exceptions:
System.ArgumentNullException array is a null reference
System.ArgumentException offset and count describe an invalid range in array.
System.ArgumentOutOfRangeException offset or count is negative.
System.IO.IOException An I/O error occurs.
System.ObjectDisposedException The stream is closed.
System.NotSupportedException The current stream instance does not support writing.

Reimplemented in Asn1PerOutputStream.

void Write2Bytes ( int  value  ) 

Write the lowest two bytes of value to the output stream. The lowest byte is written last.

Parameters:
value 
void Write4Bytes ( int  value  ) 

Write the four bytes of value to the output stream. The lowest byte is written last.

Parameters:
value 
override void WriteByte ( byte  b  ) 

Writes the specified byte to this output stream. The general contract for Write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters:
b the byte.
Exceptions:
System.ObjectDisposedException The stream is closed.
System.NotSupportedException The stream does not support writing.

Reimplemented in Asn1PerOutputStream.

virtual void WriteByte ( int  b  )  [virtual]

Writes the specified byte to this output stream. The general contract for Write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters:
b the byte.
Exceptions:
System.ObjectDisposedException The stream is closed.
System.NotSupportedException The stream does not support writing.

Reimplemented in Asn1PerOutputStream.


Member Data Documentation

internal System.IO.Stream os [protected]

C# Stream object


Property Documentation

override bool CanRead [get]

Gets a value indicating whether the current stream supports reading.

Value: false, the stream doesn't supports reading.

override bool CanSeek [get]

Gets a value indicating whether the current stream supports seeking.

Value: true if the stream supports seeking; otherwise, false.

override bool CanWrite [get]

Gets a value indicating whether the current stream supports writing.

Value: true if the stream supports writing; otherwise, false.

Asn1Context Context [get]

The context associated with this output stream.

override long Length [get]

Gets the length in bytes of the stream.

Value: A long value representing the length of the stream in bytes.

Exceptions:
System.NotSupportedException CanSeek for this stream is false.
System.IO.IOException An I/O error occurs, such as the file being closed.
override long Position [get, set]

Gets or sets the current position of this stream.

Value: The current position of this stream.

Exceptions:
System.NotSupportedException The stream does not support seeking.
System.IO.IOException An I/O error occurs.
System.ArgumentOutOfRangeException Attempted to set the position to a negative value.
System.IO.EndOfStreamException Attempted seeking past the end of a stream that does not support this.