Table of Contents

Class MemoryStreamProvider

Namespace
CarinaStudio.IO
Assembly
CarinaStudio.AppBase.Core.dll

Implementation of IStreamProvider which keeps data in memory.

public class MemoryStreamProvider : IStreamProvider
Inheritance
MemoryStreamProvider
Implements
Inherited Members
Extension Methods

Constructors

MemoryStreamProvider()

Initialize new MemoryStreamProvider.

public MemoryStreamProvider()

MemoryStreamProvider(byte[])

Initialize new MemoryStreamProvider for reading.

public MemoryStreamProvider(byte[] buffer)

Parameters

buffer byte[]

Data buffer.

MemoryStreamProvider(byte[], bool)

Initialize new MemoryStreamProvider for reading.

public MemoryStreamProvider(byte[] buffer, bool isWritable)

Parameters

buffer byte[]

Data buffer.

isWritable bool

True if data can be write back to buffer.

MemoryStreamProvider(byte[], int, int, bool)

Initialize new MemoryStreamProvider for reading.

public MemoryStreamProvider(byte[] buffer, int index, int count, bool isWritable)

Parameters

buffer byte[]

Data buffer.

index int

Index of first byte to be read or written in buffer.

count int

Number of bytes in buffer to be read or written.

isWritable bool

True if data can be write back to buffer.

Methods

CheckStreamAccess(StreamAccess)

Check whether given access to Stream is supported by this provider or not.

public bool CheckStreamAccess(StreamAccess access)

Parameters

access StreamAccess

Access to stream.

Returns

bool

True if given combination of access is supported.

OpenStreamAsync(StreamAccess, CancellationToken)

Open stream asynchronously.

public Task<Stream> OpenStreamAsync(StreamAccess access, CancellationToken token)

Parameters

access StreamAccess

Desired access to stream.

token CancellationToken

Cancellation token.

Returns

Task<Stream>

Task of opening stream.

ToByteArray()

Copy data as byte array.

public byte[] ToByteArray()

Returns

byte[]

Byte array.