C# Class 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.
Inheritance: System.IO.MemoryStream
Afficher le fichier Open project: zencoders/sambatyon Class Usage Examples

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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

Private Methods

Méthode Description
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.

Method Details

ObservableStream() public méthode

Default constructor
public ObservableStream ( ) : System
Résultat System

ObservableStream() public méthode

Byte-buffer constructor
public ObservableStream ( byte buffer ) : System
buffer byte Byte buffer used by the stream
Résultat System

ObservableStream() public méthode

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, bool writable ) : System
buffer byte
writable bool
Résultat System

ObservableStream() public méthode

See MSDN Reference for Memory Stream for Details
public ObservableStream ( byte buffer, int index, int count ) : System
buffer byte
index int
count int
Résultat System

ObservableStream() public méthode

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
Résultat System

ObservableStream() public méthode

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
Résultat System

ObservableStream() public méthode

Capacity contructor. Create a buffer with the given capacity
public ObservableStream ( int capacity ) : System
capacity int Capacity of the stream buffer
Résultat System

OnPositionChanges() protected méthode

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
Résultat void

OnWaitedPositionReached() protected méthode

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
Résultat void

WaitForMore() public méthode

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
Résultat void

Write() public méthode

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
Résultat void

WriteByte() public méthode

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
Résultat void