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
bufferbyte[]Data buffer.
MemoryStreamProvider(byte[], bool)
Initialize new MemoryStreamProvider for reading.
public MemoryStreamProvider(byte[] buffer, bool isWritable)
Parameters
MemoryStreamProvider(byte[], int, int, bool)
Initialize new MemoryStreamProvider for reading.
public MemoryStreamProvider(byte[] buffer, int index, int count, bool isWritable)
Parameters
bufferbyte[]Data buffer.
indexintIndex of first byte to be read or written in
buffer.countintNumber of bytes in
bufferto be read or written.isWritableboolTrue 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
accessStreamAccessAccess 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
accessStreamAccessDesired access to stream.
tokenCancellationTokenCancellation token.
Returns
ToByteArray()
Copy data as byte array.
public byte[] ToByteArray()
Returns
- byte[]
Byte array.