Class FileType.ContentFileTypeMap

  • Enclosing class:
    FileType

    public static class FileType.ContentFileTypeMap
    extends javax.activation.FileTypeMap
    Map that contains the file content type definitions.
    Version:
    17.0 2020-01-04 14:41:40
    Author:
    Stéphane GALLAND
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    inputoutput
    • Constructor Detail

      • ContentFileTypeMap

        public ContentFileTypeMap​(javax.activation.FileTypeMap parent)
        Constructor.
        Parameters:
        parent - is the parent of this content type map, which will be invoked if this map does not know the answer.
      • ContentFileTypeMap

        public ContentFileTypeMap()
        Constructor.
    • Method Detail

      • getContentType

        public String getContentType​(File filename)
        Specified by:
        getContentType in class javax.activation.FileTypeMap
      • getContentType

        public String getContentType​(String filename)
        Specified by:
        getContentType in class javax.activation.FileTypeMap
      • getContentType

        public String getContentType​(URL url)
        Replies the mime type of the specified url.
        Parameters:
        url - is the location of the file to test.
        Returns:
        the MIME type of the given file.
      • isContentType

        public boolean isContentType​(File filename,
                                     String mimeType)
        Replies if the given file has the given MIME type.
        Parameters:
        filename - is the filename of the file to read.
        mimeType - is the restriction type.
        Returns:
        true if the file has the given MIME type, otherwise false
      • isContentType

        public boolean isContentType​(String filename,
                                     String mimeType)
        Replies if the given file has the given MIME type.
        Parameters:
        filename - is the filename of the file to read.
        mimeType - is the restriction type.
        Returns:
        true if the file has the given MIME type, otherwise false
      • isContentType

        public boolean isContentType​(URL filename,
                                     String mimeType)
        Replies if the given file has the given MIME type.
        Parameters:
        filename - is the filename of the file to read.
        mimeType - is the restriction type.
        Returns:
        true if the file has the given MIME type, otherwise false
      • getFormatVersion

        public String getFormatVersion​(URL url)
        Replies the format version of the specified url.
        Parameters:
        url - is the name of the file to test.
        Returns:
        the MIME type of the given file.
      • getFormatVersion

        public String getFormatVersion​(File filename)
        Replies the version of the format of the given file.
        Parameters:
        filename - is the name of the file to test.
        Returns:
        the format version for the given file.
      • getFormatVersion

        public String getFormatVersion​(String filename)
        Replies the version of the format of the given file.
        Parameters:
        filename - is the name of the file to test.
        Returns:
        the format version for the given file.
      • addContentType

        public void addContentType​(MagicNumber magicNumber)
        Register a MIME type of the given file.
        Parameters:
        magicNumber - is the string that identify the type of the content.