Table of Contents

Class WritingDataSource

Namespace
ChartTools.IO.Sources
Assembly
ChartTools.dll

Represents a combination of a data source that can be written to and a ReadingDataSource to combine data with.

public class WritingDataSource : DataSource, IDisposable
Inheritance
WritingDataSource
Implements
Inherited Members

Remarks

Can be implicitly converted from a string or Stream.

Constructors

WritingDataSource(Stream, ReadingDataSource?)

Creates a WritingDataSource from a Stream.

public WritingDataSource(Stream stream, ReadingDataSource? existing = null)

Parameters

stream Stream

Stream to source from. Must be readable through CanRead and seekable through CanSeek.

existing ReadingDataSource
Source of existing data to combine during write operations

Remarks

The stream is kept alive after the lifetime of the WritingDataSource.

Exceptions

ArgumentException

The stream is not seekable and/or writable

WritingDataSource(string, ReadingDataSource?)

Creates a WritingDataSource from a file path.

public WritingDataSource(string path, ReadingDataSource? existing = null)

Parameters

path string

Path of the file to source from

existing ReadingDataSource
Source of existing data to combine during write operations . If null, uses the writing path if the file already exists.

Remarks

Initializes the stream as a FileStream with Write and Read.

The stream is disposed when disposing the WritingDataSource.

Properties

Existing

Source of existing data to combine during write operations

public ReadingDataSource? Existing { get; }

Property Value

ReadingDataSource

Remarks

Can point to the same file or share a Stream instance with the WritingDataSource.

Methods

Dispose()

Disposes the reading source if provided and stream if generated.

public override void Dispose()

Operators

implicit operator WritingDataSource(Stream)

Creates a WritingDataSource from a Stream as a target and source of existing data.

public static implicit operator WritingDataSource(Stream stream)

Parameters

stream Stream

Stream to create from

Returns

WritingDataSource

Remarks

The stream is kept alive after the lifetime of the WritingDataSource.

implicit operator WritingDataSource(string)

Creates a WritingDataSource from a file path as a target and source of existing data.

public static implicit operator WritingDataSource(string path)

Parameters

path string

Path to create from

Returns

WritingDataSource

Remarks

Initializes the stream as a FileStream with Write and Read.

The stream is disposed when disposing the WritingDataSource.