Class MediaType

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MediaType​(java.lang.String value)  
      protected MediaType​(java.lang.String type, java.lang.String subtype, java.nio.charset.Charset charset)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static MediaType create​(java.lang.String type, java.lang.String subtype)
      Create a media type with the given type and subtype.
      static MediaType create​(java.lang.String type, java.lang.String subtype, java.nio.charset.Charset charset)
      Create a media type with the given type, subtype, and charset.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      static MediaType parse​(java.lang.String value)
      Parse the given media type value.
      java.lang.String toString()
      {@return a string representation of this media type}
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TEXT_PLAIN

        public static final MediaType TEXT_PLAIN
        The text/plain media type.
      • TEXT_PLAIN_UTF_8

        public static final MediaType TEXT_PLAIN_UTF_8
        The text/plain; charset=UTF-8 media type.
      • APPLICATION_JSON

        public static final MediaType APPLICATION_JSON
        The application/json media type.
      • APPLICATION_OCTET_STREAM

        public static final MediaType APPLICATION_OCTET_STREAM
        The application/octet-stream media type.
      • IMAGE_JPEG

        public static final MediaType IMAGE_JPEG
        The image/jpeg media type.
      • IMAGE_PNG

        public static final MediaType IMAGE_PNG
        The image/png media type.
    • Constructor Detail

      • MediaType

        protected MediaType​(java.lang.String type,
                            java.lang.String subtype,
                            java.nio.charset.Charset charset)
      • MediaType

        protected MediaType​(java.lang.String value)
    • Method Detail

      • parse

        public static MediaType parse​(java.lang.String value)
        Parse the given media type value.

        Must be valid according to RFC 2045.

        Parameters:
        value - the media type value to parse; never null or blank
        Returns:
        the parsed media type
      • create

        public static MediaType create​(java.lang.String type,
                                       java.lang.String subtype)
        Create a media type with the given type and subtype.
        Parameters:
        type - the type; never null or blank
        subtype - the subtype; never null or blank
        Returns:
        the media type
      • create

        public static MediaType create​(java.lang.String type,
                                       java.lang.String subtype,
                                       java.nio.charset.Charset charset)
        Create a media type with the given type, subtype, and charset.
        Parameters:
        type - the type; never null or blank
        subtype - the subtype; never null or blank
        charset - the charset; never null
        Returns:
        the media type
      • toString

        public final java.lang.String toString()
        {@return a string representation of this media type}
        Overrides:
        toString in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object