Package libcore.net.http
Class ResponseUtils
- java.lang.Object
-
- libcore.net.http.ResponseUtils
-
public class ResponseUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description ResponseUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CharsetresponseCharset(String contentTypeHeader)Returns the response charset of a HTTP response based on theContent-Typeof the response (see RFC 7230).
-
-
-
Method Detail
-
responseCharset
public static Charset responseCharset(String contentTypeHeader) throws IllegalCharsetNameException, UnsupportedCharsetException
Returns the response charset of a HTTP response based on theContent-Typeof the response (see RFC 7230). If theContent-Typeheader is missing or invalid, the response is assumed to be encoded asUTF-8. Note that a charset usually makes sense only for"text/plain"and other "text based" responses.- Throws:
IllegalCharsetNameException- if the response specified charset is illegal.UnsupportedCharsetException- if the response specified charset is unsupported.
-
-