Class DataStreamWriter
A data stream writer.
Inheritance
System.Object
DataStreamWriter
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Data.IO.DataStreams
Assembly: Kephas.Data.IO.dll
Syntax
[ProcessingPriority(Priority.Low)]
public class DataStreamWriter : IDataStreamWriter
Constructors
| Improve this Doc View SourceDataStreamWriter(ICompositionContext, ISerializationService, IMediaTypeProvider)
Initializes a new instance of the DataStreamWriter class.
Declaration
public DataStreamWriter(ICompositionContext compositionContext, ISerializationService serializationService, IMediaTypeProvider mediaTypeProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| ICompositionContext | compositionContext | Context for the composition. |
| ISerializationService | serializationService | The serialization service. |
| IMediaTypeProvider | mediaTypeProvider | The media type provider. |
Methods
| Improve this Doc View SourceCanWrite(DataStream)
Determines whether this instance can write to the specified data source.
Declaration
public virtual bool CanWrite(DataStream dataStream)
Parameters
| Type | Name | Description |
|---|---|---|
| DataStream | dataStream | The DataStream. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
CreateEncodedStreamWriter(DataStream)
Creates the encoded stream writer.
Declaration
protected virtual StreamWriter CreateEncodedStreamWriter(DataStream dataSource)
Parameters
| Type | Name | Description |
|---|---|---|
| DataStream | dataSource | The data source. |
Returns
| Type | Description |
|---|---|
| System.IO.StreamWriter | The encoded stream writer. |
GetMediaType(DataStream)
Gets the media type for the DataStream.
Declaration
protected virtual Type GetMediaType(DataStream dataStream)
Parameters
| Type | Name | Description |
|---|---|---|
| DataStream | dataStream | The DataStream. |
Returns
| Type | Description |
|---|---|
| System.Type | The media type. |
WriteAsync(Object, DataStream, IDataIOContext, CancellationToken)
Writes the entities to the data source.
Declaration
public virtual Task WriteAsync(object data, DataStream dataStream, IDataIOContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | data | The entity or entities to be written. |
| DataStream | dataStream | The DataStream where the entities should be written. |
| IDataIOContext | context | The data I/O context (optional). |
| System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task to await. |