Class ContentItemAssetStreamSource
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Represents a source of a content item asset originating from a stream.
public sealed class ContentItemAssetStreamSource : IContentItemAssetSource
- Inheritance
-
objectContentItemAssetStreamSource
- Implements
- Extension Methods
Constructors
ContentItemAssetStreamSource(Func<CancellationToken, Task<Stream>>)
Initializes a new instance of the ContentItemAssetStreamSource class.
public ContentItemAssetStreamSource(Func<CancellationToken, Task<Stream>> getStream)
Parameters
getStreamFunc<CancellationToken, Task<Stream>>Task returning a stream sourcing the content item asset binary.
Exceptions
- ArgumentNullException
Thrown when
getStreamis null.
Properties
HasData
Indicates whether the source has content item asset data.
public bool HasData { get; }
Property Value
- bool
Remarks
This implementation returns always true.
Methods
Write(string, CancellationToken)
Writes the asset binary to targetAssetFilePath by copying the stream contents this source was initialized with.
public Task Write(string targetAssetFilePath, CancellationToken cancellationToken)
Parameters
targetAssetFilePathstringTarget file path where the asset binary is to be written.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task
Returns a task representing the asynchronous operation.
Exceptions
- ArgumentException
Thrown when
targetAssetFilePathis null or empty.