New to Telerik Document ProcessingStart a free 30-day trial

Base for format providers that import/export documents via streams, exposing capability flags and supported extensions.

Definition

Namespace:Telerik.Windows.Documents.Common.FormatProviders

Assembly:Telerik.Windows.Documents.Core.dll

Type Parameters:

T

Syntax:

C#
public abstract class FormatProviderBase<T> : IFormatProvider<T>

Inheritance: objectFormatProviderBase<T>

Derived Classes: BinaryFormatProviderBase<T>TextBasedFormatProviderBase<T>

Implements: IFormatProvider<T>

Constructors

C#
protected FormatProviderBase()

Properties

Gets a value indicating whether this provider supports export.

C#
public abstract bool CanExport { get; }
Property Value:

The value indicating whether can export.

Implements: IFormatProvider<T>.CanExport

Gets a value indicating whether this provider supports import.

C#
public abstract bool CanImport { get; }
Property Value:

The value indicating whether can import.

Implements: IFormatProvider<T>.CanImport

Gets the file extensions supported by this provider.

C#
public abstract IEnumerable<string> SupportedExtensions { get; }
Property Value:

The supported extensions.

Implements: IFormatProvider<T>.SupportedExtensions

Methods

Exports the document to the output stream with an optional timeout.

C#
public void Export(T document, Stream output, TimeSpan? timeout)
Parameters:documentT

The document.

outputStream

The output stream.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Implements: IFormatProvider<T>.Export(T, Stream, TimeSpan?)

Exports the specified document.

C#
protected virtual void ExportOverride(T document, Stream output, CancellationToken cancellationToken)
Parameters:documentT

The document.

outputStream

The output.

cancellationTokenCancellationToken

The cancellation token used to cancel the operation.

Imports a document from the input stream with an optional timeout and returns the parsed document.

C#
public T Import(Stream input, TimeSpan? timeout)
Parameters:inputStream

The input stream.

timeoutTimeSpan?

The timeout after which the operation will be cancelled.

Returns:

T

The imported document.

Exceptions:

ArgumentOutOfRangeException

The exception that is thrown when timeout is less than -1 or greater than Int32.MaxValue. Note that this upper bound is more restrictive than TimeSpan.MaxValue.

Implements: IFormatProvider<T>.Import(Stream, TimeSpan?)

Imports the specified input.

C#
protected virtual T ImportOverride(Stream input, CancellationToken cancellationToken)
Parameters:inputStream

The input.

cancellationTokenCancellationToken

The cancellation token used to cancel the operation.

Returns:

T

The imported document.