Table of Contents

Class TdbFile

Namespace
TdbIO
Assembly
TdbIO.dll

Entry point: tells the kind of a file and opens it as a TdbIO.TdbDocument.

public static class TdbFile

Inheritance

Inherited Members

Methods

DetectKind(string)

Tells the kind of a file from its first bytes (at most 64 KiB) and, for reports, its file name. Never throws for the content: data that is short, cut or not recognised gives TdbIO.TdbFileKind.Unknown.

public static TdbFileKind DetectKind(string path)

Parameters

path string

The file to examine.

Returns

TdbFileKind

The kind of the file.

Exceptions

ArgumentNullException

path is null.

ArgumentException

path is empty.

IOException

The file cannot be read.

UnauthorizedAccessException

Access to the file is denied.

DetectKind(Stream, string?)

Tells the kind of the data from its first bytes (at most 64 KiB, read from the current position) and, for reports, the file name. A seekable stream is moved back to where it was; the stream is not disposed. Never throws for the content: data that is short, cut or not recognised gives TdbIO.TdbFileKind.Unknown.

public static TdbFileKind DetectKind(Stream stream, string? fileName = null)

Parameters

stream Stream

A readable stream.

fileName string?

The file name, used only to recognise reports (.xsr), which have no signature.

Returns

TdbFileKind

The kind of the data.

Exceptions

ArgumentNullException

stream is null.

ArgumentException

stream is not readable.

IOException

The stream cannot be read.

Open(string, TdbReadOptions?)

Opens a file and reads it into the document of its kind.

public static TdbDocument Open(string path, TdbReadOptions? options = null)

Parameters

path string

The file to open.

options TdbReadOptions?

Read options; null for the defaults.

Returns

TdbDocument

The document; its type depends on TdbIO.TdbDocument.Kind.

Exceptions

ArgumentNullException

path is null.

ArgumentException

path is empty.

InvalidDataException

The file is malformed, over a limit or not recognised.

NotSupportedException

The file is recognised but not supported.

IOException

The file cannot be read.

UnauthorizedAccessException

Access to the file is denied.

Open(Stream, string?, TdbReadOptions?)

Reads the data from the current position to the end into the document of its kind. The stream need not be seekable and is not disposed.

public static TdbDocument Open(Stream stream, string? fileName = null, TdbReadOptions? options = null)

Parameters

stream Stream

A readable stream.

fileName string?

The file name, used only to recognise reports (.xsr), which have no signature.

options TdbReadOptions?

Read options; null for the defaults.

Returns

TdbDocument

The document; its type depends on TdbIO.TdbDocument.Kind.

Exceptions

ArgumentNullException

stream is null.

ArgumentException

stream is not readable.

InvalidDataException

The data is malformed, over a limit or not recognised.

NotSupportedException

The data is recognised but not supported.

IOException

The stream cannot be read.