Class MimeCache

Class for reading mime.cache files. Mime cache is mainly optimized for MIME type detection by file name.

class MimeCache ;

This class is somewhat low level and tricky to use directly. Also it knows nothing about MimeType.

Constructors

NameDescription
this Read mime cache from given file (usually mime.cache from one of mime paths)
this Read mime cache from given data.

Methods

NameDescription
aliases MIME type aliases.
fileName File name MimeCache was loaded from.
findGenericIcon Find generic icon name for mime type.
findIcon Find icon name for mime type.
findMimeTypesByData Find all MIME type alternatives for data matching it against magic rules.
findMimeTypesByGlob Find all MIME type alternatives for fileName using glob patterns which are not literals or suffices.
findMimeTypesByLiteral Find all MIME type alternatives for fileName using literal patterns like Makefile.
findMimeTypesBySuffix Find all MIME type alternatives for fileName using suffix patterns like *.cpp. Due to mime cache format characteristics it uses output range instead of returning the input one.
genericIcons Generic icons for MIME types.
globs Glob patterns that are not literal nor suffixes.
icons Icons for MIME types.
isSubclassOf Recursively check if mimeType is subclass of parent.
literals Literal patterns.
magicMatches All magic matches in this mime cache. Matches don't include magic rules themselves, but they reference matchlets.
magicMatchlets One level magic matchlets. matchletCount and firstMatchletOffset should be taken from MatchEntry or upper level MatchletEntry.
magicToDelete Names of mime types which magic rules from the least preferred mime.cache files should be discarded.
namespaces XML namespaces for MIME types.
parents Get direct parents of given mimeType.
resolveAlias Resolve MIME type name by aliasName.

Note

This class does not try to provide more information than the underlying mime.cache file has.