No cache version.


Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.
javax.activation

Class FileTypeMap

  • Direct Known Subclasses:
    MimetypesFileTypeMap

    public abstract class FileTypeMap
    extends Object
    The FileTypeMap is an abstract class that provides a data typing interface for files. Implementations of this class will implement the getContentType methods which will derive a content type from a file name or a File object. FileTypeMaps could use any scheme to determine the data type, from examining the file extension of a file (like the MimetypesFileTypeMap) to opening the file and trying to derive its type from the contents of the file. The FileDataSource class uses the default FileTypeMap (a MimetypesFileTypeMap unless changed) to determine the content type of files.
    Since:
    1.6
    See Also:
    FileTypeMap, FileDataSource, MimetypesFileTypeMap
    • Constructor Detail

      • FileTypeMap

        public FileTypeMap()
        The default constructor.
    • Method Detail

      • getContentType

        public abstract String getContentType(File file)
        Return the type of the file object. This method should always return a valid MIME type.
        Parameters:
        file - A file to be typed.
        Returns:
        The content type.
      • getContentType

        public abstract String getContentType(String filename)
        Return the type of the file passed in. This method should always return a valid MIME type.
        Parameters:
        filename - the pathname of the file.
        Returns:
        The content type.
      • setDefaultFileTypeMap

        public static void setDefaultFileTypeMap(FileTypeMap fileTypeMap)
        Sets the default FileTypeMap for the system. This instance will be returned to callers of getDefaultFileTypeMap.
        Parameters:
        fileTypeMap - The FileTypeMap.
        Throws:
        SecurityException - if the caller doesn't have permission to change the default
      • getDefaultFileTypeMap

        public static FileTypeMap getDefaultFileTypeMap()
        Return the default FileTypeMap for the system. If setDefaultFileTypeMap was called, return that instance, otherwise return an instance of MimetypesFileTypeMap.
        Returns:
        The default FileTypeMap
        See Also:
        setDefaultFileTypeMap(javax.activation.FileTypeMap)

Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/activation/filetypemap.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut