public static final class ContentType.UnmodifiableContentType extends ContentType
ContentType.UnmodifiableContentType - An unmodifiable content type.ContentType.UnmodifiableContentTypeDEFAULT_CONTENT_TYPE| Constructor and Description |
|---|
ContentType.UnmodifiableContentType(ContentType contentType)
Initializes a new
ContentType.UnmodifiableContentType. |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(java.lang.String key,
java.lang.String value)
Adds specified value to given parameter name.
|
int |
compareTo(ParameterizedHeader other) |
boolean |
containsCharsetParameter() |
boolean |
containsNameParameter() |
boolean |
containsParameter(java.lang.String key)
Checks if parameter is present
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getBaseType()
Gets this content type's base type without any parameters appended; e.g.
|
java.lang.String |
getCharsetParameter() |
java.lang.String |
getNameParameter() |
java.lang.String |
getParameter(java.lang.String key)
Gets specified parameter's value
|
java.util.Iterator<java.lang.String> |
getParameterNames()
Gets all parameter names wrapped in an
Iterator |
java.lang.String |
getPrimaryType() |
java.lang.String |
getSubType() |
int |
hashCode() |
boolean |
isMimeType(java.lang.String pattern)
Checks if Content-Type's base type matches given wildcard pattern (e.g text/plain, text/* or text/htm*)
|
java.lang.String |
removeParameter(java.lang.String key)
Removes specified parameter and returns its value
|
ContentType |
setBaseType(java.lang.String baseType)
Sets base type (e.g. text/plain)
|
ContentType |
setCharsetParameter(java.lang.String charset)
Sets
"charset" parameter |
void |
setContentType(ContentType contentType)
Applies given content type to this content type
|
void |
setContentType(java.lang.String contentType)
Sets the content type to specified content type string; e.g.
|
ContentType |
setNameParameter(java.lang.String filename)
Sets
"name" parameter |
void |
setParameter(java.lang.String key,
java.lang.String value)
Sets the given parameter.
|
ContentType |
setPrimaryType(java.lang.String primaryType)
Sets primary type
|
ContentType |
setSubType(java.lang.String subType)
Sets sub-type
|
boolean |
startsWith(java.lang.String prefix)
Checks if Content-Type's base type ignore-case starts with specified prefix.
|
java.lang.String |
toString() |
java.lang.String |
toString(boolean skipEmptyParams)
Returns a RFC2045 style (ASCII-only) string representation of this content type.
|
getBaseType, isBaseType, isMimeType, matchesBaseType, prepareContentTypeString, prepareContentTypeString, removeCharsetParameter, removeNameParameter, reset, startsWithAnyclearParameterspublic ContentType.UnmodifiableContentType(ContentType contentType)
ContentType.UnmodifiableContentType.contentType - The backing content typepublic void addParameter(java.lang.String key,
java.lang.String value)
ParameterizedHeaderaddParameter in class ParameterizedHeaderkey - The parameter namevalue - The parameter value to addpublic int compareTo(ParameterizedHeader other)
compareTo in interface java.lang.Comparable<ParameterizedHeader>compareTo in class ContentTypepublic boolean containsCharsetParameter()
containsCharsetParameter in class ContentTypetrue if "charset" parameter is present, false otherwisepublic boolean containsNameParameter()
containsNameParameter in class ContentTypetrue if "name" parameter is present, false otherwisepublic boolean containsParameter(java.lang.String key)
ParameterizedHeadercontainsParameter in class ParameterizedHeaderkey - the parameter nametrue if parameter is present; otherwise falsepublic boolean equals(java.lang.Object obj)
equals in class ContentTypepublic java.lang.String getBaseType()
ContentType"text/plain".getBaseType in class ContentTypepublic java.lang.String getCharsetParameter()
getCharsetParameter in class ContentType"charset" value or null if not presentpublic java.lang.String getNameParameter()
getNameParameter in class ContentType"name" value or null if not presentpublic java.lang.String getParameter(java.lang.String key)
ParameterizedHeadergetParameter in class ParameterizedHeaderkey - The parameter namenull if not existingpublic java.util.Iterator<java.lang.String> getParameterNames()
ParameterizedHeaderIteratorgetParameterNames in class ParameterizedHeaderIteratorpublic java.lang.String getPrimaryType()
getPrimaryType in class ContentTypepublic java.lang.String getSubType()
getSubType in class ContentTypepublic int hashCode()
hashCode in class ContentTypepublic boolean isMimeType(java.lang.String pattern)
ContentTypeisMimeType in class ContentTypetrue if Content-Type's base type matches given pattern, false otherwisepublic java.lang.String removeParameter(java.lang.String key)
ParameterizedHeaderremoveParameter in class ParameterizedHeaderkey - The parameter namenull if not existingpublic ContentType setBaseType(java.lang.String baseType) throws com.openexchange.exception.OXException
ContentTypesetBaseType in class ContentTypecom.openexchange.exception.OXExceptionpublic ContentType setCharsetParameter(java.lang.String charset)
ContentType"charset" parametersetCharsetParameter in class ContentTypecharset - The charset parameter value; e.g. "UTF-8""charset" parameter appliedpublic void setContentType(ContentType contentType)
ContentTypesetContentType in class ContentTypecontentType - The content type to applypublic void setContentType(java.lang.String contentType)
throws com.openexchange.exception.OXException
ContentTypesetContentType in class ContentTypecontentType - The content type stringcom.openexchange.exception.OXException - If specified content type string cannot be parsedpublic ContentType setNameParameter(java.lang.String filename)
ContentType"name" parametersetNameParameter in class ContentTypefilename - The name parameter"name" parameter appliedpublic void setParameter(java.lang.String key,
java.lang.String value)
ParameterizedHeadersetParameter in class ParameterizedHeaderkey - The parameter namevalue - The parameter valuepublic ContentType setPrimaryType(java.lang.String primaryType)
ContentTypesetPrimaryType in class ContentTypepublic ContentType setSubType(java.lang.String subType)
ContentTypesetSubType in class ContentTypepublic boolean startsWith(java.lang.String prefix)
ContentTypestartsWith in class ContentTypeprefix - The prefixtrue if Content-Type's base type ignore-case starts with specified prefix; otherwise falsepublic java.lang.String toString()
toString in class ContentTypepublic java.lang.String toString(boolean skipEmptyParams)
ContentTypetoString in class ContentTypeskipEmptyParams - true to skip empty parameters; otherwise false