Class MIMEType

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>, Dictionary<java.lang.String,​java.lang.String>

    public class MIMEType
    extends java.lang.Object
    implements Dictionary<java.lang.String,​java.lang.String>, java.lang.Iterable<java.lang.String>
    Utility class for introspection a MIME type string.
    • Constructor Summary

      Constructors 
      Constructor Description
      MIMEType​(java.lang.String baseType)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Tests the existence of a key in the dictionary.
      static MIMEType decode​(java.lang.String value)  
      java.lang.String get​(java.lang.String key)
      Retrieves the value for the given key.
      java.lang.String getBaseType()
      Returns the base type of this MIME type (i.e.
      java.util.Iterator<java.lang.String> iterator()  
      java.lang.String put​(java.lang.String key, java.lang.String value)
      Sets the value of the given key, creating a new entry or replacing the existing value.
      java.lang.String remove​(java.lang.String key)
      Removes a key/value pair from the map.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • MIMEType

        public MIMEType​(java.lang.String baseType)
    • Method Detail

      • getBaseType

        public java.lang.String getBaseType()
        Returns the base type of this MIME type (i.e. the type string minus parameter values).
        Returns:
        The base type.
      • get

        public java.lang.String get​(java.lang.String key)
        Description copied from interface: Dictionary
        Retrieves the value for the given key.
        Specified by:
        get in interface Dictionary<java.lang.String,​java.lang.String>
        Parameters:
        key - The key whose value is to be returned.
        Returns:
        The value corresponding to key, or null if the key does not exist. Will also return null if the key refers to a null value. Use Dictionary.containsKey(K) to distinguish between these two cases.
      • put

        public java.lang.String put​(java.lang.String key,
                                    java.lang.String value)
        Description copied from interface: Dictionary
        Sets the value of the given key, creating a new entry or replacing the existing value.
        Specified by:
        put in interface Dictionary<java.lang.String,​java.lang.String>
        Parameters:
        key - The key whose value is to be set.
        value - The value to be associated with the given key.
        Returns:
        The value previously associated with the key.
      • remove

        public java.lang.String remove​(java.lang.String key)
        Description copied from interface: Dictionary
        Removes a key/value pair from the map.
        Specified by:
        remove in interface Dictionary<java.lang.String,​java.lang.String>
        Parameters:
        key - The key whose mapping is to be removed.
        Returns:
        The value that was removed.
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Description copied from interface: Dictionary
        Tests the existence of a key in the dictionary.
        Specified by:
        containsKey in interface Dictionary<java.lang.String,​java.lang.String>
        Parameters:
        key - The key whose presence in the dictionary is to be tested.
        Returns:
        true if the key exists in the dictionary; false, otherwise.
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • decode

        public static MIMEType decode​(java.lang.String value)