[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class HttpMediaType (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpMediaType)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.HttpMediaType)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.HttpMediaType)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.HttpMediaType)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.HttpMediaType)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.HttpMediaType)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.HttpMediaType)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.HttpMediaType) \n\n public final class HttpMediaType\n\nHTTP Media-type as specified in the [HTTP RFC](https://datatracker.ietf.org/doc/html/rfc2616#section-3.7).\n\nImplementation is not thread-safe. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e HttpMediaType \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### equalsIgnoreParameters(String mediaTypeA, String mediaTypeB)\n\n public static boolean equalsIgnoreParameters(String mediaTypeA, String mediaTypeB)\n\nReturns `true` if the two specified media types have the same type and subtype, or if\nboth types are `null`.\n\nConstructors\n------------\n\n### HttpMediaType(String mediaType)\n\n public HttpMediaType(String mediaType)\n\nCreates a [HttpMediaType](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpMediaType) by parsing the specified media type string.\n\n### HttpMediaType(String type, String subType)\n\n public HttpMediaType(String type, String subType)\n\nInitializes the [HttpMediaType](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpMediaType) by setting the specified media type.\n\nMethods\n-------\n\n### build()\n\n public String build()\n\nBuilds the full media type string which can be passed in the Content-Type header.\n\n### clearParameters()\n\n public void clearParameters()\n\nRemoves all set parameters from this media type.\n\n### equals(Object obj)\n\n public boolean equals(Object obj)\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### equalsIgnoreParameters(HttpMediaType mediaType)\n\n public boolean equalsIgnoreParameters(HttpMediaType mediaType)\n\nReturns `true` if the specified media type has both the same type and subtype, or `\nfalse` if they don't match or the media type is `null`.\n\n### getCharsetParameter()\n\n public Charset getCharsetParameter()\n\nReturns the specified charset or `null` if unset.\n\n### getParameter(String name)\n\n public String getParameter(String name)\n\nReturns the value of the specified parameter or `null` if not found.\n\n### getParameters()\n\n public Map\u003cString,String\u003e getParameters()\n\nReturns an unmodifiable map of all specified parameters. Parameter names will be stored in\nlower-case in this map.\n\n### getSubType()\n\n public String getSubType()\n\nReturns the sub media type, for example `\"plain\"` when using `\"text\"`.\n\n### getType()\n\n public String getType()\n\nReturns the main media type, for example `\"text\"`, or `null` for '\\*'.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### removeParameter(String name)\n\n public HttpMediaType removeParameter(String name)\n\nRemoves the specified media parameter.\n\n### setCharsetParameter(Charset charset)\n\n public HttpMediaType setCharsetParameter(Charset charset)\n\nSets the charset parameter of the media type.\n\n### setParameter(String name, String value)\n\n public HttpMediaType setParameter(String name, String value)\n\nSets the media parameter to the specified value.\n\n### setSubType(String subType)\n\n public HttpMediaType setSubType(String subType)\n\nSets the sub media type, for example `\"plain\"` when using `\"text\"`.\n\n### setType(String type)\n\n public HttpMediaType setType(String type)\n\nSets the (main) media type, for example `\"text\"`.\n\n### toString()\n\n public String toString()\n\n**Overrides** \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)"]]