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:
public abstract class FormatProviderBase<T> : IFormatProvider<T>
Inheritance: objectFormatProviderBase<T>
Derived Classes:
Implements:
Constructors
protected FormatProviderBase()
Properties
Gets a value indicating whether this provider supports export.
public abstract bool CanExport { get; }
The value indicating whether can export.
Implements:
Gets a value indicating whether this provider supports import.
public abstract bool CanImport { get; }
The value indicating whether can import.
Implements:
Gets the file extensions supported by this provider.
public abstract IEnumerable<string> SupportedExtensions { get; }
The supported extensions.
Implements:
Methods
Exports the document to the output stream with an optional timeout.
public void Export(T document, Stream output, TimeSpan? timeout)
The document.
outputStreamThe output stream.
timeoutTimeSpan?The timeout after which the operation will be cancelled.
Exceptions: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:
Exports the specified document.
protected virtual void ExportOverride(T document, Stream output, CancellationToken cancellationToken)
The document.
outputStreamThe output.
cancellationTokenCancellationTokenThe cancellation token used to cancel the operation.
Imports a document from the input stream with an optional timeout and returns the parsed document.
public T Import(Stream input, TimeSpan? timeout)
The input stream.
timeoutTimeSpan?The timeout after which the operation will be cancelled.
Returns:T
The imported document.
Exceptions: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:
Imports the specified input.
protected virtual T ImportOverride(Stream input, CancellationToken cancellationToken)
The input.
cancellationTokenCancellationTokenThe cancellation token used to cancel the operation.
Returns:T
The imported document.