Class
BinaryFormatProviderBase<T>

Base for binary format providers that import/export documents from/to byte arrays and streams.

Definition

Namespace:Telerik.Windows.Documents.Common.FormatProviders

Assembly:Telerik.Windows.Documents.Core.dll

Type Parameters:

T

The type of the document.

Syntax:

cs-api-definition
public abstract class BinaryFormatProviderBase<T> : FormatProviderBase<T>, IFormatProvider<T>, IBinaryFormatProvider<T>

Inheritance: objectFormatProviderBase<T>BinaryFormatProviderBase<T>

Derived Classes: PdfFormatProviderDocxFormatProviderPdfFormatProvider

Implements: IBinaryFormatProvider<T>IFormatProvider<T>

Inherited Members FormatProviderBase<T>.Import(Stream)FormatProviderBase<T>.Import(Stream, TimeSpan?)FormatProviderBase<T>.Export(T, Stream)FormatProviderBase<T>.Export(T, Stream, TimeSpan?)FormatProviderBase<T>.ImportOverride(Stream)FormatProviderBase<T>.ImportOverride(Stream, CancellationToken)FormatProviderBase<T>.ExportOverride(T, Stream)FormatProviderBase<T>.ExportOverride(T, Stream, CancellationToken)FormatProviderBase<T>.SupportedExtensionsFormatProviderBase<T>.CanImportFormatProviderBase<T>.CanExport

Constructors

BinaryFormatProviderBase()

Declaration

cs-api-definition
protected BinaryFormatProviderBase()

Methods

Export(T)

Exports the document to a byte array representation.

Declaration

cs-api-definition
[Obsolete("This method is obsolete. Please use Export(T document, TimeSpan? timeout) instead.")]
public byte[] Export(T document)

Parameters

document

T

The document.

Returns

byte[]

The result byte array.

Implements IBinaryFormatProvider<T>.Export(T)

Export(T, TimeSpan?)

Exports the document to a byte array with an optional timeout.

Declaration

cs-api-definition
public byte[] Export(T document, TimeSpan? timeout)

Parameters

document

T

The document.

timeout

TimeSpan?

The timeout after which the operation will be cancelled.

Returns

byte[]

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 IBinaryFormatProvider<T>.Export(T, TimeSpan?)

Import(byte[])

Imports a document from a byte array and returns the parsed document instance.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[Obsolete("This method is obsolete. Please use Import(byte[] input, TimeSpan? timeout) instead.")]
public T Import(byte[] input)

Parameters

input

byte[]

The input.

Returns

T

The document.

Implements IBinaryFormatProvider<T>.Import(byte[])

Import(byte[], TimeSpan?)

Imports a document from a byte array with an optional timeout and returns the parsed document.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public T Import(byte[] input, TimeSpan? timeout)

Parameters

input

byte[]

The input.

timeout

TimeSpan?

The timeout after which the operation will be cancelled.

Returns

T

The 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 IBinaryFormatProvider<T>.Import(byte[], TimeSpan?)