|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.http.HttpMediaType
public final class HttpMediaType
HTTP Media-type as specified in the HTTP RFC ( "http://tools.ietf.org/html/rfc2616#section-3.7").
Upgrade warning: Since version 1.11 parameter values are parsed less restrictively in order to conform with the multipart specification ( "http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html"). Prior to version 1.11 parameter values were parsed according to the HTTP RFC.
Implementation is not thread-safe.
| Constructor Summary | |
|---|---|
HttpMediaType(String mediaType)
Creates a HttpMediaType by parsing the specified media type string. |
|
HttpMediaType(String type,
String subType)
Initializes the HttpMediaType by setting the specified media type. |
|
| Method Summary | |
|---|---|
String |
build()
Builds the full media type string which can be passed in the Content-Type header. |
void |
clearParameters()
Removes all set parameters from this media type. |
boolean |
equals(Object obj)
|
boolean |
equalsIgnoreParameters(HttpMediaType mediaType)
Returns true if the specified media type has both the same type and subtype, or
false if they don't match or the media type is null. |
static boolean |
equalsIgnoreParameters(String mediaTypeA,
String mediaTypeB)
Returns true if the two specified media types have the same type and subtype, or if
both types are null. |
Charset |
getCharsetParameter()
Returns the specified charset or null if unset. |
String |
getParameter(String name)
Returns the value of the specified parameter or null if not found. |
Map<String,String> |
getParameters()
Returns an unmodifiable map of all specified parameters. |
String |
getSubType()
Returns the sub media type, for example "plain" when using "text". |
String |
getType()
Returns the main media type, for example "text", or null for '*'. |
int |
hashCode()
|
HttpMediaType |
removeParameter(String name)
Removes the specified media parameter. |
HttpMediaType |
setCharsetParameter(Charset charset)
Sets the charset parameter of the media type. |
HttpMediaType |
setParameter(String name,
String value)
Sets the media parameter to the specified value. |
HttpMediaType |
setSubType(String subType)
Sets the sub media type, for example "plain" when using "text". |
HttpMediaType |
setType(String type)
Sets the (main) media type, for example "text". |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpMediaType(String type,
String subType)
HttpMediaType by setting the specified media type.
type - main media type, for example "text"subType - sub media type, for example "plain"public HttpMediaType(String mediaType)
HttpMediaType by parsing the specified media type string.
mediaType - full media type string, for example "text/plain; charset=utf-8"| Method Detail |
|---|
public HttpMediaType setType(String type)
"text".
type - main/major media typepublic String getType()
"text", or null for '*'.
public HttpMediaType setSubType(String subType)
"plain" when using "text".
subType - sub media typepublic String getSubType()
"plain" when using "text".
public HttpMediaType setParameter(String name,
String value)
name - case-insensitive name of the parametervalue - value of the parameter or null to removepublic String getParameter(String name)
null if not found.
name - name of the parameterpublic HttpMediaType removeParameter(String name)
name - parameter to removepublic void clearParameters()
public Map<String,String> getParameters()
public String build()
public boolean equalsIgnoreParameters(HttpMediaType mediaType)
true if the specified media type has both the same type and subtype, or
false if they don't match or the media type is null.
public static boolean equalsIgnoreParameters(String mediaTypeA,
String mediaTypeB)
true if the two specified media types have the same type and subtype, or if
both types are null.
public HttpMediaType setCharsetParameter(Charset charset)
charset - new value for the charset parameter or null to removepublic Charset getCharsetParameter()
null if unset.
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||