Class MimeType


  • public final class MimeType
    extends java.lang.Object
    Utility holding information about association between MIME type and file extensions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getFileExtension​(java.lang.String contentType)
      Gets the preferred file extension for a content type.
      static boolean isJavascriptMimeType​(java.lang.String mimeType)
      See https://mimesniff.spec.whatwg.org/#javascript-mime-type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • APPLICATION_JAVASCRIPT

        public static final java.lang.String APPLICATION_JAVASCRIPT
        "application/javascript".
        See Also:
        Constant Field Values
      • APPLICATION_OCTET_STREAM

        public static final java.lang.String APPLICATION_OCTET_STREAM
        "application/octet-stream".
        See Also:
        Constant Field Values
      • APPLICATION_JSON

        public static final java.lang.String APPLICATION_JSON
        "application/json".
        See Also:
        Constant Field Values
      • APPLICATION_XHTML

        public static final java.lang.String APPLICATION_XHTML
        application/xhtml+xml.
        See Also:
        Constant Field Values
      • TEXT_PLAIN

        public static final java.lang.String TEXT_PLAIN
        "text/plain".
        See Also:
        Constant Field Values
    • Method Detail

      • isJavascriptMimeType

        public static boolean isJavascriptMimeType​(java.lang.String mimeType)
        See https://mimesniff.spec.whatwg.org/#javascript-mime-type.
        Parameters:
        mimeType - the type to check
        Returns:
        true if the mime type is for js
      • getFileExtension

        public static java.lang.String getFileExtension​(java.lang.String contentType)
        Gets the preferred file extension for a content type.
        Parameters:
        contentType - the mime type
        Returns:
        null if none is known