类 ContentType


  • public class ContentType
    extends Object
    The HTTP Content Type header value.
    • 方法详细资料

      • of

        public static ContentType of​(MimeType mimeType)
        Create a ContentType, which do not care about charset encoding.
        参数:
        mimeType - the mime type
        返回:
        ContentType instance
      • of

        public static ContentType of​(MimeType mimeType,
                                     Charset charset)
        Create a ContentType with a charset, used for Textual ContentType.
        参数:
        mimeType - the mime type
        charset - the charset
        返回:
        ContentType instance
      • multiPart

        public static ContentType multiPart​(String boundary)
        Create a multi-part Content-Type.
        参数:
        boundary - the boundary
        返回:
        multi-part Content-Type instance.
      • safeParse

        public static Optional<ContentType> safeParse​(String contentTypeStr)
        Parse from content type str.
        参数:
        contentTypeStr - the content-type str
        返回:
        If parse failed, return empty Optional.
      • mimeType

        public MimeType mimeType()
        The mime type
      • charset

        public Optional<Charset> charset()
        The charset set, only for textual content-type.
      • boundary

        public String boundary()
        The boundary, only for multi part content-type.
      • hashCode

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