public final class ContentTypeBuilder extends Object
ContentType objects. This class can be used to construct ContentType
objects or as a mutable alternative to ContentType (which is designed to be immutable).| Constructor and Description |
|---|
ContentTypeBuilder(ContentType type)
Constructor that initializes the builder with the media type and parameters from an existing
ContentType object. |
ContentTypeBuilder(MediaType mediaType)
Constructor that initializes the builder with a media type and no parameters.
|
ContentTypeBuilder(String type)
Constructor that parses a Content-Type header value.
|
| Modifier and Type | Method and Description |
|---|---|
ContentType |
build()
Build the
ContentType object. |
void |
clearParameters()
Remove all parameters.
|
MediaType |
getMediaType()
Get the media type.
|
String |
getParameter(String name)
Get the specified parameter value.
|
void |
setMediaType(MediaType mediaType)
Set the media type.
|
void |
setParameter(String name,
String value)
Set the specified parameter value.
|
String |
toString()
Create a string representation of the content type.
|
public ContentTypeBuilder(MediaType mediaType)
mediaType - the media typepublic ContentTypeBuilder(ContentType type)
ContentType object.type - the content typepublic ContentTypeBuilder(String type) throws ParseException
type - the value of the Content-Type header conforming to RFC 2045ParseException - if the value is invalid and could not be parsedpublic MediaType getMediaType()
public void setMediaType(MediaType mediaType)
mediaType - the media typepublic String getParameter(String name)
name - the parameter namenull if no parameter with the given name was
foundpublic void setParameter(String name, String value)
name - the parameter namevalue - the parameter valuepublic void clearParameters()
public ContentType build()
ContentType object.ContentType objectpublic String toString()
ContentType.toString().Copyright © The Apache Software Foundation. All Rights Reserved.