Class EtlPipelineFixedWidthExtensions

Namespace
Wolfgang.Etl.FixedWidth
Assembly
Wolfgang.Etl.FixedWidth.dll

Class-named fixed-width source factories and sink terminators for the fluent Wolfgang.Etl.Abstractions.EtlPipeline chain (issue #253). Source factories hang off Wolfgang.Etl.Abstractions.EtlPipeline so a pipeline reads EtlPipeline.Create().FixedWidthExtractor<Person>("people.txt"); sink terminators hang off Wolfgang.Etl.Abstractions.IEtlPipeline<T> so it ends … .FixedWidthLoader<Person>("out.txt").RunAsync().

public static class EtlPipelineFixedWidthExtensions
Inheritance
EtlPipelineFixedWidthExtensions
Inherited Members

Remarks

Path-based factories own the file stream they open and dispose it after the run (success or failure). Factories that accept a caller-supplied Stream, TextReader, TextWriter, or a pre-built extractor do not dispose it — the caller owns the lifecycle and, for a writer, is responsible for flushing it. The fluent setters returned by these factories map 1:1 to the underlying FixedWidthExtractor<T> / FixedWidthLoader<T> properties; encoding is set via the builder's Encoding method.

Methods

FixedWidthExtractor<T>(EtlPipeline, Stream)

Begins a pipeline that reads fixed-width records from stream. The caller retains ownership of the stream; only the extractor's internal reader is disposed.

public static IFixedWidthExtractorBuilder<T> FixedWidthExtractor<T>(this EtlPipeline pipeline, Stream stream) where T : notnull, new()

Parameters

pipeline EtlPipeline

The seed returned by Wolfgang.Etl.Abstractions.EtlPipeline.Create().

stream Stream

The stream to read from.

Returns

IFixedWidthExtractorBuilder<T>

A fluent IFixedWidthExtractorBuilder<T>.

Type Parameters

T

The record type to produce.

Exceptions

ArgumentNullException

pipeline or stream is null.

FixedWidthExtractor<T>(EtlPipeline, TextReader)

Begins a pipeline that reads fixed-width records from reader. The caller retains ownership of the reader; nothing is disposed by the pipeline.

public static IFixedWidthExtractorBuilder<T> FixedWidthExtractor<T>(this EtlPipeline pipeline, TextReader reader) where T : notnull, new()

Parameters

pipeline EtlPipeline

The seed returned by Wolfgang.Etl.Abstractions.EtlPipeline.Create().

reader TextReader

The reader to read from.

Returns

IFixedWidthExtractorBuilder<T>

A fluent IFixedWidthExtractorBuilder<T>.

Type Parameters

T

The record type to produce.

Exceptions

ArgumentNullException

pipeline or reader is null.

FixedWidthExtractor<T>(EtlPipeline, string)

Begins a pipeline that reads fixed-width records from the file at path. The opened file reader is owned by the pipeline and disposed when the run finishes.

public static IFixedWidthExtractorBuilder<T> FixedWidthExtractor<T>(this EtlPipeline pipeline, string path) where T : notnull, new()

Parameters

pipeline EtlPipeline

The seed returned by Wolfgang.Etl.Abstractions.EtlPipeline.Create().

path string

The path of the fixed-width file to read.

Returns

IFixedWidthExtractorBuilder<T>

A fluent IFixedWidthExtractorBuilder<T>.

Type Parameters

T

The record type to produce.

Exceptions

ArgumentNullException

pipeline or path is null.

FixedWidthExtractor<T>(EtlPipeline, FixedWidthExtractor<T>)

Begins a pipeline from an already-configured FixedWidthExtractor<TRecord>. The caller retains ownership of the instance; nothing is disposed by the pipeline. The returned builder can still layer further configuration over the supplied extractor.

public static IFixedWidthExtractorBuilder<T> FixedWidthExtractor<T>(this EtlPipeline pipeline, FixedWidthExtractor<T> extractor) where T : notnull, new()

Parameters

pipeline EtlPipeline

The seed returned by Wolfgang.Etl.Abstractions.EtlPipeline.Create().

extractor FixedWidthExtractor<T>

The extractor that seeds the pipeline.

Returns

IFixedWidthExtractorBuilder<T>

A fluent IFixedWidthExtractorBuilder<T>.

Type Parameters

T

The record type to produce.

Exceptions

ArgumentNullException

pipeline or extractor is null.

FixedWidthLoader<T>(IEtlPipeline<T>, Stream)

Terminates the pipeline by writing fixed-width records to stream. The caller retains ownership of the stream; only the loader's internal writer is disposed.

public static IFixedWidthLoaderBuilder<T> FixedWidthLoader<T>(this IEtlPipeline<T> pipeline, Stream stream) where T : notnull

Parameters

pipeline IEtlPipeline<T>

The pipeline to terminate.

stream Stream

The stream to write to.

Returns

IFixedWidthLoaderBuilder<T>

A fluent IFixedWidthLoaderBuilder<T>.

Type Parameters

T

The record type to write.

Exceptions

ArgumentNullException

pipeline or stream is null.

FixedWidthLoader<T>(IEtlPipeline<T>, TextWriter)

Terminates the pipeline by writing fixed-width records to writer. The caller retains ownership of the writer and is responsible for flushing it; nothing is disposed by the pipeline.

public static IFixedWidthLoaderBuilder<T> FixedWidthLoader<T>(this IEtlPipeline<T> pipeline, TextWriter writer) where T : notnull

Parameters

pipeline IEtlPipeline<T>

The pipeline to terminate.

writer TextWriter

The writer to write to.

Returns

IFixedWidthLoaderBuilder<T>

A fluent IFixedWidthLoaderBuilder<T>.

Type Parameters

T

The record type to write.

Exceptions

ArgumentNullException

pipeline or writer is null.

FixedWidthLoader<T>(IEtlPipeline<T>, string)

Terminates the pipeline by writing fixed-width records to the file at path. The opened file writer is owned by the pipeline and disposed after the run, flushing to disk.

public static IFixedWidthLoaderBuilder<T> FixedWidthLoader<T>(this IEtlPipeline<T> pipeline, string path) where T : notnull

Parameters

pipeline IEtlPipeline<T>

The pipeline to terminate.

path string

The path of the fixed-width file to write. An existing file is overwritten.

Returns

IFixedWidthLoaderBuilder<T>

A fluent IFixedWidthLoaderBuilder<T>.

Type Parameters

T

The record type to write.

Exceptions

ArgumentNullException

pipeline or path is null.