Class HttpMediaType
java.lang.Object
com.google.api.client.http.HttpMediaType
-
Constructor Summary
ConstructorsConstructorDescriptionHttpMediaType(String mediaType) Creates aHttpMediaTypeby parsing the specified media type string.HttpMediaType(String type, String subType) Initializes theHttpMediaTypeby setting the specified media type. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the full media type string which can be passed in the Content-Type header.voidRemoves all set parameters from this media type.booleanbooleanequalsIgnoreParameters(HttpMediaType mediaType) Returnstrueif the specified media type has both the same type and subtype, orfalseif they don't match or the media type isnull.static booleanequalsIgnoreParameters(String mediaTypeA, String mediaTypeB) Returnstrueif the two specified media types have the same type and subtype, or if both types arenull.Returns the specified charset ornullif unset.getParameter(String name) Returns the value of the specified parameter ornullif not found.Returns an unmodifiable map of all specified parameters.Returns the sub media type, for example"plain"when using"text".getType()Returns the main media type, for example"text", ornullfor '*'.inthashCode()removeParameter(String name) Removes the specified media parameter.setCharsetParameter(Charset charset) Sets the charset parameter of the media type.setParameter(String name, String value) Sets the media parameter to the specified value.setSubType(String subType) Sets the sub media type, for example"plain"when using"text".Sets the (main) media type, for example"text".toString()
-
Constructor Details
-
HttpMediaType
Initializes theHttpMediaTypeby setting the specified media type.- Parameters:
type- main media type, for example"text"subType- sub media type, for example"plain"
-
HttpMediaType
Creates aHttpMediaTypeby parsing the specified media type string.- Parameters:
mediaType- full media type string, for example"text/plain; charset=utf-8"
-
-
Method Details
-
setType
Sets the (main) media type, for example"text".- Parameters:
type- main/major media type
-
getType
Returns the main media type, for example"text", ornullfor '*'. -
setSubType
Sets the sub media type, for example"plain"when using"text".- Parameters:
subType- sub media type
-
getSubType
Returns the sub media type, for example"plain"when using"text". -
setParameter
Sets the media parameter to the specified value.- Parameters:
name- case-insensitive name of the parametervalue- value of the parameter ornullto remove
-
getParameter
-
removeParameter
Removes the specified media parameter.- Parameters:
name- parameter to remove
-
clearParameters
public void clearParameters()Removes all set parameters from this media type. -
getParameters
-
build
Builds the full media type string which can be passed in the Content-Type header. -
toString
-
equalsIgnoreParameters
Returnstrueif the specified media type has both the same type and subtype, orfalseif they don't match or the media type isnull. -
equalsIgnoreParameters
-
setCharsetParameter
Sets the charset parameter of the media type.- Parameters:
charset- new value for the charset parameter ornullto remove
-
getCharsetParameter
Returns the specified charset ornullif unset. -
hashCode
-
equals
-