Table of Contents

Class TabularHandler<T>

Namespace
Addax.Formats.Tabular
Assembly
Addax.Formats.Tabular.dll

Defines the core behavior of reading an object from or writing an object to a tabular record and provides a base for derived classes.

public abstract class TabularHandler<T> where T : notnull

Type Parameters

T

The type of object handled by the record handler.

Inheritance
TabularHandler<T>
Derived

Constructors

TabularHandler()

Initializes a new instance of the TabularHandler<T> class.

protected TabularHandler()

Properties

Header

Gets the names of the record fields.

public virtual IEnumerable<string?>? Header { get; }

Property Value

IEnumerable<string>

An collection of strings or null.

Methods

Read(TabularReader)

When overridden in a derived class, reads the next record using the specified reader.

public virtual TabularRecord<T> Read(TabularReader reader)

Parameters

reader TabularReader

The reader to read with.

Returns

TabularRecord<T>

A container that may or may not have a record.

Remarks

Throws a NotSupportedException exception by default.

ReadAsync(TabularReader, CancellationToken)

When overridden in a derived class, asynchronously reads the next record using the specified reader.

public virtual ValueTask<TabularRecord<T>> ReadAsync(TabularReader reader, CancellationToken cancellationToken)

Parameters

reader TabularReader

The reader to read with.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

ValueTask<TabularRecord<T>>

A task object that, when awaited, produces a container that may or may not have a record.

Remarks

Throws a NotSupportedException exception by default.

Write(TabularWriter, T)

When overridden in a derived class, writes the next record using the specified writer.

public virtual void Write(TabularWriter writer, T record)

Parameters

writer TabularWriter

The writer to write with.

record T

The object to write.

Remarks

Throws a NotSupportedException exception by default.

WriteAsync(TabularWriter, T, CancellationToken)

When overridden in a derived class, asynchronously writes the next record using the specified writer.

public virtual ValueTask WriteAsync(TabularWriter writer, T record, CancellationToken cancellationToken)

Parameters

writer TabularWriter

The writer to write with.

record T

The object to write.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

ValueTask

A task object.

Remarks

Throws a NotSupportedException exception by default.