Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: RT.KitchenSink.Streams.ControlCodedStream

Summary

Implements a stream which enables control codes to be read from or written to the underlying stream at certain points. This stream handles encoding and decoding the control codes and ensuring they are distinguishable from the payload data. See Remarks.

Remarks

This stream does not support seeking because of the variable length nature of the data between control points. Seeking directly on the underlying stream must be avoided, since seeking into the middle of an escape sequence will result in incorrect data being read.

Constructors

Constructor.

Instance methods

void
  • Overrides: Stream.Flush()
Flushes the underlying stream.
int
Read(byte[] buffer, int offset, int count)
  • Overrides: Stream.Read(byte[], int, int)
Reads up to count bytes into the buffer from the underlying stream. If a control code is encountered before any data has been read, will throw an InvalidOperationException. If some data has already been read upon encountering a control code, will stop and return all the data read up to the control code.
int
  • Virtual
Reads a control code from the stream at the current position. If there is no control code at the current position, returns -1. Otherwise returns the code read. Throws EndOfStreamException if the stream ends in the middle of a control code.
long
Seek(long offset, SeekOrigin origin)
  • Overrides: Stream.Seek(long, SeekOrigin)
Throws a NotSupportedException.
void
SetLength(long value)
  • Overrides: Stream.SetLength(long)
void
Write(byte[] buffer, int offset, int count)
  • Overrides: Stream.Write(byte[], int, int)
Writes the specified data to the underlying stream.
void
WriteControlCode(byte code)
  • Virtual
Writes the specified control code to the stream.

Instance properties

bool
  • Overrides: Stream.CanRead
Indicates whether the underlying stream, and hence this stream, supports reading.
bool
  • Overrides: Stream.CanSeek
Always returns false.
bool
  • Overrides: Stream.CanWrite
Indicates whether the underlying stream, and hence this stream, supports writing.
bool Determines if the stream has ended. Note that this method may block, potentially indefinitely, in cases where it isn't known yet if the stream has ended (for example, a NetworkStream for a socket that is idle but not closed).
long
  • Overrides: Stream.Length
Throws a NotSupportedException.
long
  • Overrides: Stream.Position