public static final class ContentType.UnmodifiableContentType extends ContentType
ContentType.UnmodifiableContentType
- An unmodifiable content type.ContentType.UnmodifiableContentType
DEFAULT_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, startsWithAny
clearParameters
public ContentType.UnmodifiableContentType(ContentType contentType)
ContentType.UnmodifiableContentType
.contentType
- The backing content typepublic void addParameter(java.lang.String key, java.lang.String value)
ParameterizedHeader
addParameter
in class ParameterizedHeader
key
- The parameter namevalue
- The parameter value to addpublic int compareTo(ParameterizedHeader other)
compareTo
in interface java.lang.Comparable<ParameterizedHeader>
compareTo
in class ContentType
public boolean containsCharsetParameter()
containsCharsetParameter
in class ContentType
true
if "charset"
parameter is present, false
otherwisepublic boolean containsNameParameter()
containsNameParameter
in class ContentType
true
if "name"
parameter is present, false
otherwisepublic boolean containsParameter(java.lang.String key)
ParameterizedHeader
containsParameter
in class ParameterizedHeader
key
- the parameter nametrue
if parameter is present; otherwise false
public boolean equals(java.lang.Object obj)
equals
in class ContentType
public java.lang.String getBaseType()
ContentType
"text/plain"
.getBaseType
in class ContentType
public 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)
ParameterizedHeader
getParameter
in class ParameterizedHeader
key
- The parameter namenull
if not existingpublic java.util.Iterator<java.lang.String> getParameterNames()
ParameterizedHeader
Iterator
getParameterNames
in class ParameterizedHeader
Iterator
public java.lang.String getPrimaryType()
getPrimaryType
in class ContentType
public java.lang.String getSubType()
getSubType
in class ContentType
public int hashCode()
hashCode
in class ContentType
public boolean isMimeType(java.lang.String pattern)
ContentType
isMimeType
in class ContentType
true
if Content-Type's base type matches given pattern, false
otherwisepublic java.lang.String removeParameter(java.lang.String key)
ParameterizedHeader
removeParameter
in class ParameterizedHeader
key
- The parameter namenull
if not existingpublic ContentType setBaseType(java.lang.String baseType) throws com.openexchange.exception.OXException
ContentType
setBaseType
in class ContentType
com.openexchange.exception.OXException
public ContentType setCharsetParameter(java.lang.String charset)
ContentType
"charset"
parametersetCharsetParameter
in class ContentType
charset
- The charset parameter value; e.g. "UTF-8"
"charset"
parameter appliedpublic void setContentType(ContentType contentType)
ContentType
setContentType
in class ContentType
contentType
- The content type to applypublic void setContentType(java.lang.String contentType) throws com.openexchange.exception.OXException
ContentType
setContentType
in class ContentType
contentType
- 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 ContentType
filename
- The name parameter"name"
parameter appliedpublic void setParameter(java.lang.String key, java.lang.String value)
ParameterizedHeader
setParameter
in class ParameterizedHeader
key
- The parameter namevalue
- The parameter valuepublic ContentType setPrimaryType(java.lang.String primaryType)
ContentType
setPrimaryType
in class ContentType
public ContentType setSubType(java.lang.String subType)
ContentType
setSubType
in class ContentType
public boolean startsWith(java.lang.String prefix)
ContentType
startsWith
in class ContentType
prefix
- The prefixtrue
if Content-Type's base type ignore-case starts with specified prefix; otherwise false
public java.lang.String toString()
toString
in class ContentType
public java.lang.String toString(boolean skipEmptyParams)
ContentType
toString
in class ContentType
skipEmptyParams
- true
to skip empty parameters; otherwise false