@Test public void testWithCharset() throws Exception { ContentType contentType = ContentType.create("text/plain", "US-ASCII"); Assert.assertEquals("text/plain", contentType.getMimeType()); Assert.assertEquals(StandardCharsets.US_ASCII, contentType.getCharset()); Assert.assertEquals("text/plain; charset=US-ASCII", contentType.toString()); contentType = contentType.withCharset(Charset.forName("UTF-8")); Assert.assertEquals("text/plain", contentType.getMimeType()); Assert.assertEquals("UTF-8", contentType.getCharset().name()); Assert.assertEquals("text/plain; charset=UTF-8", contentType.toString()); }
public ContentType withCharset(final Charset charset) { return create(this.getMimeType(), charset); }
ContentType implements Serializable { public ContentType withCharset(final Charset charset) { return create(this.getMimeType(), charset); } }
ContentType implements Serializable { public ContentType withCharset(final Charset charset) { return create(this.getMimeType(), charset); } ContentType(
            final String mimeType,
            final Charset charset);   ContentType(
            final String mimeType,
            final Charset charset,
            final NameValuePair[] params); }
ContentType implements Serializable { public ContentType withCharset(final Charset charset) { return create(this.getMimeType(), charset); } ContentType(
            final String mimeType,
            final Charset charset);   ContentType(
            final String mimeType,
            final Charset charset,
            final NameValuePair[] params); String getMimeType(); Charset getCharset(); String getParameter(final String name); @Override String toString(); static ContentType create(final String mimeType, final Charset charset); static ContentType create(final String mimeType); static ContentType create(
            final String mimeType, final String charset); static ContentType create(
            final String mimeType, final NameValuePair... params); static ContentType parse(final CharSequence s); static ContentType parseLenient(final CharSequence s); @Deprecated static ContentType getByMimeType(final String mimeType); ContentType withCharset(final Charset charset); ContentType withCharset(final String charset); ContentType withParameters(
            final NameValuePair... params); boolean isSameMimeType(final ContentType contentType); }
ContentType implements Serializable { public ContentType withCharset(final Charset charset) { return create(this.getMimeType(), charset); } ContentType(
            final String mimeType,
            final Charset charset);   ContentType(
            final String mimeType,
            final Charset charset,
            final NameValuePair[] params); String getMimeType(); Charset getCharset(); String getParameter(final String name); @Override String toString(); static ContentType create(final String mimeType, final Charset charset); static ContentType create(final String mimeType); static ContentType create(
            final String mimeType, final String charset); static ContentType create(
            final String mimeType, final NameValuePair... params); static ContentType parse(final CharSequence s); static ContentType parseLenient(final CharSequence s); @Deprecated static ContentType getByMimeType(final String mimeType); ContentType withCharset(final Charset charset); ContentType withCharset(final String charset); ContentType withParameters(
            final NameValuePair... params); boolean isSameMimeType(final ContentType contentType); static final ContentType APPLICATION_ATOM_XML; static final ContentType APPLICATION_FORM_URLENCODED; static final ContentType APPLICATION_JSON; static final ContentType APPLICATION_OCTET_STREAM; static final ContentType APPLICATION_SOAP_XML; static final ContentType APPLICATION_SVG_XML; static final ContentType APPLICATION_XHTML_XML; static final ContentType APPLICATION_XML; static final ContentType IMAGE_BMP; static final ContentType IMAGE_GIF; static final ContentType IMAGE_JPEG; static final ContentType IMAGE_PNG; static final ContentType IMAGE_SVG; static final ContentType IMAGE_TIFF; static final ContentType IMAGE_WEBP; static final ContentType MULTIPART_FORM_DATA; static final ContentType TEXT_HTML; static final ContentType TEXT_PLAIN; static final ContentType TEXT_XML; static final ContentType WILDCARD; static final ContentType DEFAULT_TEXT; static final ContentType DEFAULT_BINARY; }