类 MediaType

java.lang.Object
com.lark.oapi.okhttp.MediaType

public final class MediaType extends Object
An RFC 2045 Media Type, appropriate to describe the content type of an HTTP request or response body.
  • 方法概要

    修饰符和类型
    方法
    说明
    Returns the charset of this media type, or null if this media type doesn't specify a charset.
    charset(Charset defaultValue)
    Returns the charset of this media type, or defaultValue if either this media type doesn't specify a charset, of it its charset is unsupported by the current runtime.
    boolean
    equals(Object other)
     
    static MediaType
    get(String string)
    Returns a media type for string.
    int
     
    static MediaType
    parse(String string)
    Returns a media type for string, or null if string is not a well-formed media type.
    Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
    Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a Content-Type header.
    Returns the high-level media type, such as "text", "image", "audio", "video", or "application".

    从类继承的方法 java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • 方法详细资料

    • get

      public static MediaType get(String string)
      Returns a media type for string.
      抛出:
      IllegalArgumentException - if string is not a well-formed media type.
    • parse

      @Nullable public static MediaType parse(String string)
      Returns a media type for string, or null if string is not a well-formed media type.
    • type

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

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

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

      @Nullable public Charset charset(@Nullable Charset defaultValue)
      Returns the charset of this media type, or defaultValue if either this media type doesn't specify a charset, of it its charset is unsupported by the current runtime.
    • toString

      public String toString()
      Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a Content-Type header.
      覆盖:
      toString 在类中 Object
    • equals

      public boolean equals(@Nullable Object other)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object