C# Класс wpf_player.ObservableStream

This class extends memory stream to allow waiting state management and position change notify. Using the WaitForMore method, a event will be launched when the needed data has been read. Position Changed event will be launched when more data has been written on the stream: the maximum resolution for this events is 1024 byte; if the position changed for less than 1024 byte the event won't be raised.
Наследование: System.IO.MemoryStream
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ObservableStream ( ) : System

Default constructor

ObservableStream ( byte buffer ) : System

Byte-buffer constructor

ObservableStream ( byte buffer, bool writable ) : System

See MSDN Reference for Memory Stream for Details

ObservableStream ( byte buffer, int index, int count ) : System

See MSDN Reference for Memory Stream for Details

ObservableStream ( byte buffer, int index, int count, bool writable ) : System

See MSDN Reference for Memory Stream for Details

ObservableStream ( byte buffer, int index, int count, bool writable, bool isVisible ) : System

See MSDN Reference for Memory Stream for Details

ObservableStream ( int capacity ) : System

Capacity contructor. Create a buffer with the given capacity

WaitForMore ( int how_many = 15000 ) : void

Sets the waiting state for the stream and sets the position waited.

Write ( byte buffer, int offset, int count ) : void

This method after the call of the base class implementation uses the launchEvent method to raise the right event See MSDN Reference for Memory Stream for Details.

WriteByte ( byte value ) : void

This method after the call of the base class implementation uses the launchEvent method to raise the right event See MSDN Reference for Memory Stream for Details.

Защищенные методы

Метод Описание
OnPositionChanges ( EventArgs args ) : void

This method calls the event handler for the position changed event

OnWaitedPositionReached ( EventArgs args ) : void

This method calls the event handler for the waited position reached event

Приватные методы

Метод Описание
launchEvent ( ) : void

This method is used to launch stream events. This performs check for waiting state and last launched position and raise the right event in the right moment.

Описание методов

ObservableStream() публичный Метод

Default constructor
public ObservableStream ( ) : System
Результат System

ObservableStream() публичный Метод

Byte-buffer constructor
public ObservableStream ( byte buffer ) : System
buffer byte Byte buffer used by the stream
Результат System

ObservableStream() публичный Метод

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, bool writable ) : System
buffer byte
writable bool
Результат System

ObservableStream() публичный Метод

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, int index, int count ) : System
buffer byte
index int
count int
Результат System

ObservableStream() публичный Метод

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, int index, int count, bool writable ) : System
buffer byte
index int
count int
writable bool
Результат System

ObservableStream() публичный Метод

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, int index, int count, bool writable, bool isVisible ) : System
buffer byte
index int
count int
writable bool
isVisible bool
Результат System

ObservableStream() публичный Метод

Capacity contructor. Create a buffer with the given capacity
public ObservableStream ( int capacity ) : System
capacity int Capacity of the stream buffer
Результат System

OnPositionChanges() защищенный Метод

This method calls the event handler for the position changed event
protected OnPositionChanges ( EventArgs args ) : void
args System.EventArgs Arguments that will be passed to the handler
Результат void

OnWaitedPositionReached() защищенный Метод

This method calls the event handler for the waited position reached event
protected OnWaitedPositionReached ( EventArgs args ) : void
args System.EventArgs Arguments that will be passed to the handler
Результат void

WaitForMore() публичный Метод

Sets the waiting state for the stream and sets the position waited.
public WaitForMore ( int how_many = 15000 ) : void
how_many int Number of bytes needed. Default is 15000
Результат void

Write() публичный Метод

This method after the call of the base class implementation uses the launchEvent method to raise the right event See MSDN Reference for Memory Stream for Details.
public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
Результат void

WriteByte() публичный Метод

This method after the call of the base class implementation uses the launchEvent method to raise the right event See MSDN Reference for Memory Stream for Details.
public WriteByte ( byte value ) : void
value byte
Результат void