Class MediaType


  • public final class MediaType
    extends java.lang.Object
    Since:
    0.1
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.charset.Charset charset()
      Returns the charset of this media type, or null if this media type doesn't specify a charset.
      java.nio.charset.Charset charset​(java.nio.charset.Charset defaultValue)
      Returns the charset of this media type, or defaultValue if this media type doesn't specify a charset.
      boolean equals​(java.lang.Object o)  
      boolean equalsType​(MediaType mediaType)  
      boolean equalsTypeSubType​(MediaType mediaType)  
      boolean equalsTypeSubTypeWithoutSuffix​(MediaType mediaType)  
      static MediaType fromOkHttpMediaType​(okhttp3.MediaType mediaType)
      Returns a media type by parsing mediaType, or DEFAULT if mediaType is null.
      int hashCode()  
      java.lang.String nuxeoEntity()
      Returns the Nuxeo Entity
      static MediaType parse​(java.lang.String string)
      Returns a media type for string, or DEFAULT if string is not a well-formed media type.
      java.lang.String subtype()
      Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
      okhttp3.MediaType toOkHttpMediaType()  
      java.lang.String toString()
      Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a Content-Type header.
      java.lang.String type()
      Returns the high-level media type, such as "text", "image", "audio", "video", or "application".
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_STRING

        protected static final java.lang.String DEFAULT_STRING
        Since:
        3.1
        See Also:
        Constant Field Values
      • DEFAULT

        protected static final MediaType DEFAULT
        Since:
        3.1
    • Method Detail

      • type

        public java.lang.String type()
        Returns the high-level media type, such as "text", "image", "audio", "video", or "application".
      • subtype

        public java.lang.String subtype()
        Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
      • charset

        public java.nio.charset.Charset charset()
        Returns the charset of this media type, or null if this media type doesn't specify a charset.
      • nuxeoEntity

        public java.lang.String nuxeoEntity()
        Returns the Nuxeo Entity
      • charset

        public java.nio.charset.Charset charset​(java.nio.charset.Charset defaultValue)
        Returns the charset of this media type, or defaultValue if this media type doesn't specify a charset.
      • toOkHttpMediaType

        public okhttp3.MediaType toOkHttpMediaType()
      • equalsType

        public boolean equalsType​(MediaType mediaType)
      • equalsTypeSubType

        public boolean equalsTypeSubType​(MediaType mediaType)
      • equalsTypeSubTypeWithoutSuffix

        public boolean equalsTypeSubTypeWithoutSuffix​(MediaType mediaType)
      • toString

        public java.lang.String toString()
        Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a Content-Type header.
        Overrides:
        toString in class java.lang.Object
      • equals

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

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

        public static MediaType fromOkHttpMediaType​(okhttp3.MediaType mediaType)
        Returns a media type by parsing mediaType, or DEFAULT if mediaType is null.
        Returns:
        a media type by parsing mediaType, or DEFAULT if mediaType is null
      • parse

        public static MediaType parse​(java.lang.String string)
        Returns a media type for string, or DEFAULT if string is not a well-formed media type.
        Returns:
        a media type for string, or DEFAULT if string is not a well-formed media type