IFileFormat

Description

interface Tinman.Terrain.Util.IFileFormat

Derived from

IPleaseIncludeInBinaryThanks

Extended by

FileFormat abstract

Base interface for classes that can read and optionally write certain file formats.

Public / Methods

Can​Read

3 overloads


public method CanRead1 → (1)

data in : ByteBuffer

[not-null]
The data to check. Must have at least Prefix remaining bytes, otherwise this method will always return false. The buffer will not be modified by this method.

returns → bool

true if the given data in is prefixed with the identifying byte sequence of this file format,
false if the prefix is not present.

Can this file format object be used to read the given data?


public method CanRead2 → (1)

file in : Path

[not-null]
The file to check.

returns → bool

true if the given file in is prefixed with the identifying byte sequence of this file format or - if not present - has a matching file suffix,
false if the prefix is not present and the file suffix does not match.

Can this file format object be used to read the given file?

Use CanRead1 to check only for the byte prefix and CanRead3 for the name suffix.

IOException

If an I/O error has occurred while reading the file data prefix.


public method CanRead3 → (2)

suffix in : string

[not-null]
The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.

directory opt : bool = false

Does the path refer to a directory (true) or to a file (false)?

returns → bool

true if this file format can be used, false if not.

Can this file format object be used to read the given path?

Can​Read​Find

3 overloads


public method CanReadFind1 → (1)

data in : ByteBuffer

[not-null]
The data to check. Must have at least Prefix remaining bytes, otherwise this method will always return false. The buffer will not be modified by this method.

returns → IFileFormat

The found file format or null.

Returns the first file format in the chain (see Next) that can read the given data, according to the file data prefix.


public method CanReadFind2 → (1)

file in : Path

[not-null]
The file to check.

returns → IFileFormat

The found file format or null.

Returns the first file format in the chain (see Next) that can read the given file, according to the file data prefix or the file suffix (if no prefix is present).

IOException

If an I/O error has occurred while reading the file data prefix.


public method CanReadFind3 → (2)

suffix in : string

[not-null]
The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.

directory opt : bool = false

Does the path refer to a directory (true) or to a file (false)?

returns → IFileFormat

The found file format or null.

Returns the first file format in the chain (see Next) that can read the given path, according to the file suffix.

Can​Write


public method CanWrite → (1)

suffix in : string

[not-null]
The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.

returns → bool

true if this file format can be used, false if not.

Can this file format object be used to write the given path?

Can​Write​Find


public method CanWriteFind → (1)

suffix in : string

[not-null]
The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.

returns → IFileFormat

The found file format or null.

Returns the first file format in the chain (see Next) that can write the given path.

Public / Attributes

Description


public attribute Description → (get)

value : string

[not-null]
The description string.

Long description of this file format.

Mime


public attribute Mime → (get)

value : string

The machine-readable media type or null if none.

The machine-readable type of this file format.

For details on Media Types (aka. MIME-type), please refer to this webpage:
https://www.iana.org/assignments/media-types/media-types.xhtml

Name


public attribute Name → (get)

value : string

[not-null]
The file format name.

The file format name.

Next


[ThreadSafe]
public attribute Next → (get)

value : IFileFormat

The next file format or null.

Returns the next file format.

The first file format can be obtained from implementing classes. This property can be used to cycle all available file formats of the same type.

Prefix


public attribute Prefix → (get)

value : int32

[>=0]
The file data prefix length, in bytes. If 0, there is no identifying prefix.

Lengths of the binary file data prefix that identifies this file format.

Type


public attribute Type → (get)

value : string

[not-null]
The human-readable type name.

The human-readable type of this file format (e.g. images, shapes, 3D models).