Interface MimeType

All Superinterfaces:
Serializable
All Known Implementing Classes:
MimeTypeEnum

public interface MimeType extends Serializable
Identifies a file MimeType and its attributes
  • Method Details

    • getMimeTypeString

      String getMimeTypeString()
      Gets String identifying the MimeType
      Returns:
      the mimeTypeString
    • getExtension

      String getExtension()
      Returns file extension corresponding to the MimeType
      Returns:
      String file extension
    • fromMimeTypeString

      static MimeType fromMimeTypeString(String mimeTypeString)
      This method returns the first representation of the MimeType corresponding to the given mime-type string.
      Parameters:
      mimeTypeString - is a string identifier composed of two parts: a "type" and a "subtype"
      Returns:
      the extrapolated mime-type from the String
    • fromFileExtension

      static MimeType fromFileExtension(String fileExtension)
      Returns MimeType matching to the provided fileExtension String
      Parameters:
      fileExtension - String
      Returns:
      MimeType if associated MimeType found, MimeTypeEnum.BINARY otherwise
    • fromFileName

      static MimeType fromFileName(String fileName)
      This method returns the mime-type extrapolated from the file name.
      Parameters:
      fileName - String the file name to be analysed
      Returns:
      String the extrapolated mime-type of the file name if found, MimeTypeEnum.BINARY otherwise
    • fromFile

      static MimeType fromFile(File file)
      This method returns the mime-type extrapolated from the file.
      Parameters:
      file - File the file to be analysed
      Returns:
      the extrapolated mime-type of the file if found, MimeTypeEnum.BINARY otherwise
    • getFileExtension

      static String getFileExtension(String fileName)
      Returns the file extension based on the position of the '.' in the fileName. File paths as "xxx.y/toto" are not handled.
      Parameters:
      fileName - to be analysed
      Returns:
      the file extension or null
    • mimeTypeLoaders

      static Iterable<MimeTypeLoader> mimeTypeLoaders()