- java.lang.Object
-
- net.dongliu.cute.http.ContentType
-
public class ContentType extends Object
The HTTP Content Type header value.
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 Stringboundary()The boundary, only for multi part content-type.Optional<Charset>charset()The charset set, only for textual content-type.booleanequals(Object o)inthashCode()MimeTypemimeType()The mime typestatic ContentTypemultiPart(String boundary)Create a multi-part Content-Type.static ContentTypeof(MimeType mimeType)Create a ContentType, which do not care about charset encoding.static ContentTypeof(MimeType mimeType, Charset charset)Create a ContentType with a charset, used for Textual ContentType.static Optional<ContentType>safeParse(String contentTypeStr)Parse from content type str.StringtoString()
-
-
-
方法详细资料
-
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 typecharset- 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
-
boundary
public String boundary()
The boundary, only for multi part content-type.
-
-