abstract class Tinman.Terrain.Util.FileFormat

Derived from


Extended by

ImageFormat abstract
ModelFormat abstract
SceneDataFormat abstract
ShapeFormat abstract

Abstract base class for IFileFormat implementations that represent a concrete file format.

Public / Constructors


public static method ForMime → (1)

mime in : string

The file image media type.

returns → IFileFormat

The file format or null if not found.

Returns a registered file format by its IFileFormat.Mime.

Public / Methods


public static method Normalize → (1)

mime in : string

The MIME type.

returns → string

The normalized MIME type of null iff mime in is empty or whitespace.

Normalizes the given MIME type.

The given mime in is converted to lower-case and all leading and trailing whitespaces are trimmed. Then, the following substitutions are performed:

  • image/jpe -> image/jpeg

  • image/jpg -> image/jpeg

  • image/tif -> image/tiff

Protected / Constructors


protected constructor FileFormat → (5)

name in : string

Value for IFileFormat.Name

description in : string

Value for IFileFormat.Description

type in : string

Value for IFileFormat.Type

mime in : string

Value for IFileFormat.Mime

isAny opt : bool = false

Is this an automatic file format?

Creates a new instance of FileFormat.

Protected / Methods


protected virtual method DoCanRead → (1)

data in : ByteBuffer

The data to check for the presence of the identifying prefix. When this method is called, this buffer position and limit will have been set so that the remaining bytes cover the byte sequence to check, having a length of exactly IFileFormat.Prefix bytes. The buffer position may be modified by this method.

returns → bool

true if data in is equal to the identifying prefix,
false if data in is not equal to the identifying prefix.

Checks if the given data is equal to the identifying prefix of this file format.

When overriding this method, IFileFormat.Prefix must be overridden as well.


protected method NameFind → (1)

name in : string

The file format name.

returns → IFileFormat

The found file format or null.

Finds the IFileFormat that has the given name.


protected static method NotSupported → (5)

source in : string

The error source tag.

path in : Path

Path to the unsupported image data.

name in : string

Name of the image format.

directory in : bool

true if path in refers to a directory,
false if it refers to a file.

suffix in : string

The image format suffix, excluding the '.' character.

returns → IOException

The ready-to-throw exception.

Creates a new instance of IOException for the case that a file format is not supported.


protected method Register → (1)

any in : FileFormat

The file format chain to append to.

Appends this file format to the chain of the given file format.

Protected / Attributes


protected attribute IsRegistered → (get)

value : bool

true if this file format has been registered, false if not.

Has this file format been registered?