Enum MIMEType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MIMEType>

    public enum MIMEType
    extends java.lang.Enum<MIMEType>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String definition  
      private static java.util.Map<java.lang.String,​MIMEType> ENUM_MAP  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MIMEType​(java.lang.String definition)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static MIMEType get​(java.lang.String name)  
      boolean is​(java.lang.String string)  
      static java.lang.String removeParams​(java.lang.String typeString)
      Removes the (optional) parameters from a valid MIME type string, as defined in the MIME Sniffing standard.
      java.lang.String toString()  
      static MIMEType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MIMEType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • DTBOOK

        public static final MIMEType DTBOOK
      • EPUB

        public static final MIMEType EPUB
      • HTML

        public static final MIMEType HTML
      • IMAGE_JPEG

        public static final MIMEType IMAGE_JPEG
      • IMAGE_GIF

        public static final MIMEType IMAGE_GIF
      • IMAGE_PNG

        public static final MIMEType IMAGE_PNG
      • OEBPS

        public static final MIMEType OEBPS
      • PACKAGE_DOC

        public static final MIMEType PACKAGE_DOC
      • SEARCH_KEY_MAP

        public static final MIMEType SEARCH_KEY_MAP
      • SMIL

        public static final MIMEType SMIL
      • XHTML

        public static final MIMEType XHTML
      • OTHER

        public static final MIMEType OTHER
    • Field Detail

      • ENUM_MAP

        private static final java.util.Map<java.lang.String,​MIMEType> ENUM_MAP
      • definition

        private final java.lang.String definition
    • Constructor Detail

      • MIMEType

        private MIMEType​(java.lang.String definition)
    • Method Detail

      • values

        public static MIMEType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MIMEType c : MIMEType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MIMEType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<MIMEType>
      • is

        public boolean is​(java.lang.String string)
      • get

        public static MIMEType get​(java.lang.String name)
      • removeParams

        public static java.lang.String removeParams​(java.lang.String typeString)
        Removes the (optional) parameters from a valid MIME type string, as defined in the MIME Sniffing standard. In other words, this returns the essence ("type/subtype") of the MIME type described in the given string.

        For instance, calling this method on MIME type string "audio/ogg; codecs=speex" will return the string "audio/ogg".

        Note: no validation is performed on the MIME type string itself; it simply returns the substring before the first ";" character.

        Parameters:
        typeString - a MIME type string
        Returns:
        a MIME type string with any parameter removed