|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.openexchange.mail.mime.ParameterizedHeader
com.openexchange.mail.mime.ContentType
public class ContentType
ContentType.UnmodifiableContentType - Parses value of MIME header Content-Type
| Nested Class Summary | |
|---|---|
static class |
ContentType.UnmodifiableContentType
ContentType.UnmodifiableContentType - An unmodifiable content type. |
| Field Summary | |
|---|---|
static ContentType |
DEFAULT_CONTENT_TYPE
The (unmodifiable) default content type: text/plain; charset=us-ascii |
| Constructor Summary | |
|---|---|
ContentType()
Initializes a new ContentType.UnmodifiableContentType |
|
ContentType(java.lang.String contentType)
Initializes a new ContentType.UnmodifiableContentType |
|
| Method Summary | |
|---|---|
int |
compareTo(ParameterizedHeader other)
|
boolean |
containsCharsetParameter()
|
boolean |
containsNameParameter()
|
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getBaseType()
Gets this content type's base type without any parameters appended; e.g. |
static java.lang.String |
getBaseType(java.lang.String mimeType)
Detects the base type of given MIME type |
java.lang.String |
getCharsetParameter()
|
java.lang.String |
getNameParameter()
|
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*) |
static boolean |
isMimeType(java.lang.String mimeType,
java.lang.String pattern)
Checks if given MIME type's base type matches given wildcard pattern (e.g text/plain, text/* or text/htm*) |
static java.lang.String |
prepareContentTypeString(java.lang.String contentType)
Parses and prepares specified content-type string for being inserted into a MIME part's headers. |
static java.lang.String |
prepareContentTypeString(java.lang.String contentType,
java.lang.String name)
Parses and prepares specified content-type string for being inserted into a MIME part's headers. |
void |
reset()
Resets this ContentType.UnmodifiableContentType instance. |
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 |
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.ParameterizedHeader |
|---|
addParameter, containsParameter, getParameter, getParameterNames, removeParameter, setParameter |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ContentType DEFAULT_CONTENT_TYPE
text/plain; charset=us-ascii
| Constructor Detail |
|---|
public ContentType()
ContentType.UnmodifiableContentType
public ContentType(java.lang.String contentType)
throws MailException
ContentType.UnmodifiableContentType
contentType - The content type
MailException - If content type cannot be parsed| Method Detail |
|---|
public void reset()
ContentType.UnmodifiableContentType instance.
public int compareTo(ParameterizedHeader other)
compareTo in interface java.lang.Comparable<ParameterizedHeader>compareTo in class ParameterizedHeaderpublic int hashCode()
hashCode in class ParameterizedHeaderpublic boolean equals(java.lang.Object obj)
equals in class ParameterizedHeaderpublic void setContentType(ContentType contentType)
contentType - The content type to applypublic java.lang.String getPrimaryType()
public ContentType setPrimaryType(java.lang.String primaryType)
public java.lang.String getSubType()
public ContentType setSubType(java.lang.String subType)
public java.lang.String getBaseType()
"text/plain".
public ContentType setBaseType(java.lang.String baseType)
throws MailException
MailExceptionpublic ContentType setCharsetParameter(java.lang.String charset)
"charset" parameter
charset - The charset parameter value; e.g. "UTF-8"
"charset" parameter appliedpublic java.lang.String getCharsetParameter()
"charset" value or null if not presentpublic boolean containsCharsetParameter()
true if "charset" parameter is present, false otherwisepublic ContentType setNameParameter(java.lang.String filename)
"name" parameter
filename - The name parameter
"name" parameter appliedpublic java.lang.String getNameParameter()
"name" value or null if not presentpublic boolean containsNameParameter()
true if "name" parameter is present, false otherwise
public void setContentType(java.lang.String contentType)
throws MailException
contentType - The content type string
MailException - If specified content type string cannot be parsedpublic boolean isMimeType(java.lang.String pattern)
true if Content-Type's base type matches given pattern, false otherwisepublic boolean startsWith(java.lang.String prefix)
prefix - The prefix
true if Content-Type's base type ignore-case starts with specified prefix; otherwise false
java.lang.IllegalArgumentException - If specified prefix is null
public static java.lang.String prepareContentTypeString(java.lang.String contentType)
throws MailException
contentType - The content-type string to process
MailException - If parsing content-type string fails
public static java.lang.String prepareContentTypeString(java.lang.String contentType,
java.lang.String name)
throws MailException
contentType - The content-type string to processname - The optional name parameter to set if no "name" parameter is present in specified content-type string; pass
null to ignore
MailException - If parsing content-type string fails
public static boolean isMimeType(java.lang.String mimeType,
java.lang.String pattern)
throws MailException
mimeType - The MIME typepattern - The pattern
true if pattern matches; otherwise false
MailException - If an invalid MIME type is detected
public static java.lang.String getBaseType(java.lang.String mimeType)
throws MailException
mimeType - The MIME type
MailException - If an invalid MIME type is detectedpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean skipEmptyParams)
skipEmptyParams - true to skip empty parameters; otherwise false
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||