com.openexchange.mail.mime
Class ContentType.UnmodifiableContentType

java.lang.Object
  extended by com.openexchange.mail.mime.ParameterizedHeader
      extended by com.openexchange.mail.mime.ContentType
          extended by com.openexchange.mail.mime.ContentType.UnmodifiableContentType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ParameterizedHeader>
Enclosing class:
ContentType

public static final class ContentType.UnmodifiableContentType
extends ContentType

ContentType.UnmodifiableContentType - An unmodifiable content type.

Since:
Open-Xchange v6.16
Author:
Thorben Betten
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.openexchange.mail.mime.ContentType
ContentType.UnmodifiableContentType
 
Field Summary
 
Fields inherited from class com.openexchange.mail.mime.ContentType
DEFAULT_CONTENT_TYPE
 
Constructor Summary
ContentType.UnmodifiableContentType(ContentType contentType)
          Initializes a new ContentType.UnmodifiableContentType.
 
Method Summary
 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.
 
Methods inherited from class com.openexchange.mail.mime.ContentType
getBaseType, isMimeType, prepareContentTypeString, prepareContentTypeString, reset
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentType.UnmodifiableContentType

public ContentType.UnmodifiableContentType(ContentType contentType)
Initializes a new ContentType.UnmodifiableContentType.

Parameters:
contentType - The backing content type
Method Detail

addParameter

public void addParameter(java.lang.String key,
                         java.lang.String value)
Description copied from class: ParameterizedHeader
Adds specified value to given parameter name. If existing, the parameter is treated as a contiguous parameter according to RFC2231.

Overrides:
addParameter in class ParameterizedHeader
Parameters:
key - The parameter name
value - The parameter value to add

compareTo

public int compareTo(ParameterizedHeader other)
Specified by:
compareTo in interface java.lang.Comparable<ParameterizedHeader>
Overrides:
compareTo in class ContentType

containsCharsetParameter

public boolean containsCharsetParameter()
Overrides:
containsCharsetParameter in class ContentType
Returns:
true if "charset" parameter is present, false otherwise

containsNameParameter

public boolean containsNameParameter()
Overrides:
containsNameParameter in class ContentType
Returns:
true if "name" parameter is present, false otherwise

containsParameter

public boolean containsParameter(java.lang.String key)
Description copied from class: ParameterizedHeader
Checks if parameter is present

Overrides:
containsParameter in class ParameterizedHeader
Parameters:
key - the parameter name
Returns:
true if parameter is present; otherwise false

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class ContentType

getBaseType

public java.lang.String getBaseType()
Description copied from class: ContentType
Gets this content type's base type without any parameters appended; e.g. "text/plain".

Overrides:
getBaseType in class ContentType
Returns:
The base type

getCharsetParameter

public java.lang.String getCharsetParameter()
Overrides:
getCharsetParameter in class ContentType
Returns:
the "charset" value or null if not present

getNameParameter

public java.lang.String getNameParameter()
Overrides:
getNameParameter in class ContentType
Returns:
the "name" value or null if not present

getParameter

public java.lang.String getParameter(java.lang.String key)
Description copied from class: ParameterizedHeader
Gets specified parameter's value

Overrides:
getParameter in class ParameterizedHeader
Parameters:
key - The parameter name
Returns:
The parameter's value or null if not existing

getParameterNames

public java.util.Iterator<java.lang.String> getParameterNames()
Description copied from class: ParameterizedHeader
Gets all parameter names wrapped in an Iterator

Overrides:
getParameterNames in class ParameterizedHeader
Returns:
All parameter names wrapped in an Iterator

getPrimaryType

public java.lang.String getPrimaryType()
Overrides:
getPrimaryType in class ContentType
Returns:
primary type

getSubType

public java.lang.String getSubType()
Overrides:
getSubType in class ContentType
Returns:
sub-type

hashCode

public int hashCode()
Overrides:
hashCode in class ContentType

isMimeType

public boolean isMimeType(java.lang.String pattern)
Description copied from class: ContentType
Checks if Content-Type's base type matches given wildcard pattern (e.g text/plain, text/* or text/htm*)

Overrides:
isMimeType in class ContentType
Returns:
true if Content-Type's base type matches given pattern, false otherwise

removeParameter

public java.lang.String removeParameter(java.lang.String key)
Description copied from class: ParameterizedHeader
Removes specified parameter and returns its value

Overrides:
removeParameter in class ParameterizedHeader
Parameters:
key - The parameter name
Returns:
The parameter's value or null if not existing

setBaseType

public ContentType setBaseType(java.lang.String baseType)
                        throws MailException
Description copied from class: ContentType
Sets base type (e.g. text/plain)

Overrides:
setBaseType in class ContentType
Returns:
This content type with new base type applied
Throws:
MailException

setCharsetParameter

public ContentType setCharsetParameter(java.lang.String charset)
Description copied from class: ContentType
Sets "charset" parameter

Overrides:
setCharsetParameter in class ContentType
Parameters:
charset - The charset parameter value; e.g. "UTF-8"
Returns:
This content type with new "charset" parameter applied

setContentType

public void setContentType(ContentType contentType)
Description copied from class: ContentType
Applies given content type to this content type

Overrides:
setContentType in class ContentType
Parameters:
contentType - The content type to apply

setContentType

public void setContentType(java.lang.String contentType)
                    throws MailException
Description copied from class: ContentType
Sets the content type to specified content type string; e.g. "text/plain; charset=US-ASCII"

Overrides:
setContentType in class ContentType
Parameters:
contentType - The content type string
Throws:
MailException - If specified content type string cannot be parsed

setNameParameter

public ContentType setNameParameter(java.lang.String filename)
Description copied from class: ContentType
Sets "name" parameter

Overrides:
setNameParameter in class ContentType
Parameters:
filename - The name parameter
Returns:
This content type with new "name" parameter applied

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
Description copied from class: ParameterizedHeader
Sets the given parameter. Existing value is overwritten.

Overrides:
setParameter in class ParameterizedHeader
Parameters:
key - The parameter name
value - The parameter value

setPrimaryType

public ContentType setPrimaryType(java.lang.String primaryType)
Description copied from class: ContentType
Sets primary type

Overrides:
setPrimaryType in class ContentType
Returns:
This content type with new primary type applied

setSubType

public ContentType setSubType(java.lang.String subType)
Description copied from class: ContentType
Sets sub-type

Overrides:
setSubType in class ContentType
Returns:
This content type with new sub-type applied

startsWith

public boolean startsWith(java.lang.String prefix)
Description copied from class: ContentType
Checks if Content-Type's base type ignore-case starts with specified prefix.

Overrides:
startsWith in class ContentType
Parameters:
prefix - The prefix
Returns:
true if Content-Type's base type ignore-case starts with specified prefix; otherwise false

toString

public java.lang.String toString()
Overrides:
toString in class ContentType

toString

public java.lang.String toString(boolean skipEmptyParams)
Description copied from class: ContentType
Returns a RFC2045 style (ASCII-only) string representation of this content type.

Overrides:
toString in class ContentType
Parameters:
skipEmptyParams - true to skip empty parameters; otherwise false
Returns:
A RFC2045 style (ASCII-only) string representation of this content type