Package 

Class MediaType


  • 
    public final class MediaType
    
                        

    An RFC 2045 Media Type, appropriate to describe the content type of an HTTP mobonRequest or response body.

    • Method Summary

      Modifier and Type Method Description
      static MediaType parse(String string) Returns a media type for {@code string}, or null if {@code string} is not a well-formed mediatype.
      String type() Returns the high-level media type, such as "text", "image", "audio", "video", or"application".
      String subtype() Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
      Charset charset() Returns the charset of this media type, or null if this media type doesn't specify a charset.
      Charset charset(@Nullable() Charset defaultValue) Returns the charset of this media type, or {@code defaultValue} if either this media typedoesn't specify a charset, of it its charset is unsupported by the current runtime.
      String toString() Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in aContent-Type header.
      boolean equals(@Nullable() Object other)
      int hashCode()
      • Methods inherited from class java.lang.Object

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

      • parse

        @Nullable() static MediaType parse(String string)

        Returns a media type for {@code string}, or null if {@code string} is not a well-formed mediatype.

      • type

         String type()

        Returns the high-level media type, such as "text", "image", "audio", "video", or"application".

      • subtype

         String subtype()

        Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".

      • charset

        @Nullable() Charset charset()

        Returns the charset of this media type, or null if this media type doesn't specify a charset.

      • charset

        @Nullable() Charset charset(@Nullable() Charset defaultValue)

        Returns the charset of this media type, or {@code defaultValue} if either this media typedoesn't specify a charset, of it its charset is unsupported by the current runtime.

      • toString

         String toString()

        Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in aContent-Type header.