C# Class OpenSyno.Services.ReadWriteMemoryStream

A memory stream with the ability to write data at the end of it while reading at an arbitrary position.
Only the Read and Write method were implemented. This stream can be typically used to start using the first chunks of data of a file before it is completely downloaded, when it is located on a slow link. Example : Start playing an mp3 file before it is completely downloaded.
Inheritance: System.IO.MemoryStream
Afficher le fichier Open project: salfab/open-syno

Méthodes publiques

Méthode Description
BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
Close ( ) : void
Read ( byte buffer, int offset, int count ) : int

Reads a block of bytes from the current stream and writes the data to buffer.

ReadWriteMemoryStream ( int size ) : System

Initializes a new instance of the ReadWriteMemoryStream class.

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

Writes a block of bytes to the current stream using data read from buffer.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Method Details

BeginRead() public méthode

public BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
buffer byte
offset int
count int
callback AsyncCallback
state object
Résultat IAsyncResult

Close() public méthode

public Close ( ) : void
Résultat void

Dispose() protected méthode

protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

Read() public méthode

Reads a block of bytes from the current stream and writes the data to buffer.
is null. or is negative. subtracted from the buffer length is less than . The current stream instance is closed.
public Read ( byte buffer, int offset, int count ) : int
buffer byte When this method returns, contains the specified byte array with the values between and ( + - 1) replaced by the characters read from the current stream.
offset int The byte offset in at which to begin reading.
count int The maximum number of bytes to read.
Résultat int

ReadWriteMemoryStream() public méthode

Initializes a new instance of the ReadWriteMemoryStream class.
public ReadWriteMemoryStream ( int size ) : System
size int The size.
Résultat System

Write() public méthode

Writes a block of bytes to the current stream using data read from buffer.
is null. The stream does not support writing. For additional information see .-or- The current position is closer than bytes to the end of the stream, and the capacity cannot be modified. subtracted from the buffer length is less than . or are negative. An I/O error occurs. The current stream instance is closed.
public Write ( byte buffer, int offset, int count ) : void
buffer byte The buffer to write data from.
offset int The byte offset in at which to begin writing from.
count int The maximum number of bytes to write.
Résultat void