Skip to content

TFPMimeTypes

Class to manage list of mime type mappings.

Declaration

Source position: fpmimetypes.pp line 48

type

  TFPMimeTypes = class(TComponent)
  public
    constructor Create;
    destructor Destroy;
    procedure Clear;
    procedure LoadKnownTypes;
    class function GetNextExtension : string;
    procedure LoadFromStream;
    procedure LoadFromFile;
    procedure AddType;
    function GetMimeExtensions : string;
    function GetMimeType : string;
    function GetKnownMimeTypes : Integer;
    function GetKnownExtensions : Integer;
  end;

Description

TFPMimeTypes manages a list of MIME types.

The list of types can be initialized with the OS list of known MIME types through the LoadKnownTypes method, or a file in the standard mime.types format can be loaded through the LoadFromFile method.

The associated mime type of a file extension can be retrieved with TFPMimeTypes.GetMimeType.

Methods

Member Visibility Description
AddType public Add a MIME type to the list.
Clear public Clear the list of known MIME types.
Create public Create a new instance of the TFPMimeTypes class.
Destroy public Remove instance from memory.
GetKnownExtensions public Get a lis of all known extensions.
GetKnownMimeTypes public Get a list of all known MIME types.
GetMimeExtensions public Get the extensions associated with a MIME type.
GetMimeType public Get MIME type of an extension.
GetNextExtension public Extract an extension from an extension list as returned by GetMimeExtensions.
LoadFromFile public Load mime types from a file in mime.types file format.
LoadFromStream public Load mime types from a stream in mime.types file format.
LoadKnownTypes public Queries the OS for a list of known MIME types.
See all Methods

See also

Name Description
TFPMimeTypes.LoadKnownTypes Queries the OS for a list of known MIME types.
TFPMimeTypes.LoadFromFile Load mime types from a file in mime.types file format.
TFPMimeTypes.GetMimeType Get MIME type of an extension.