org.apache.james.mime4j.field
public class ContentTypeField extends AbstractField
Content-Type
field.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PARAM_BOUNDARY
The name of the
boundary parameter. |
static java.lang.String |
PARAM_CHARSET
The name of the
charset parameter. |
static java.lang.String |
TYPE_MESSAGE_RFC822
The
message/rfc822 MIME type. |
static java.lang.String |
TYPE_MULTIPART_DIGEST
The
multipart/digest MIME type. |
static java.lang.String |
TYPE_MULTIPART_PREFIX
The prefix of all
multipart MIME types. |
static java.lang.String |
TYPE_TEXT_PLAIN
The
text/plain MIME type. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBoundary()
Gets the value of the
boundary parameter if set. |
java.lang.String |
getCharset()
Gets the value of the
charset parameter if set. |
static java.lang.String |
getCharset(ContentTypeField f)
Gets the value of the
charset parameter if set for the
given field. |
java.lang.String |
getMimeType()
Gets the MIME type defined in this Content-Type field.
|
static java.lang.String |
getMimeType(ContentTypeField child,
ContentTypeField parent)
Gets the MIME type defined in the child's Content-Type field or derives a
MIME type from the parent if child is
null or hasn't got a
MIME type value set. |
java.lang.String |
getParameter(java.lang.String name)
Gets the value of a parameter.
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
Gets all parameters.
|
org.apache.james.mime4j.field.contenttype.parser.ParseException |
getParseException()
Gets the exception that was raised during parsing of the field value, if
any; otherwise, null.
|
boolean |
isMimeType(java.lang.String mimeType)
Determines if the MIME type of this field matches the given one.
|
boolean |
isMultipart()
Determines if the MIME type of this field is
multipart/* . |
getBody, getName, getParser, getRaw, isValidField, parse, parse, toString
public static final java.lang.String TYPE_MULTIPART_PREFIX
multipart
MIME types.public static final java.lang.String TYPE_MULTIPART_DIGEST
multipart/digest
MIME type.public static final java.lang.String TYPE_TEXT_PLAIN
text/plain
MIME type.public static final java.lang.String TYPE_MESSAGE_RFC822
message/rfc822
MIME type.public static final java.lang.String PARAM_BOUNDARY
boundary
parameter.public static final java.lang.String PARAM_CHARSET
charset
parameter.public org.apache.james.mime4j.field.contenttype.parser.ParseException getParseException()
getParseException
in interface ParsedField
getParseException
in class AbstractField
null
if the field is valid.ParsedField.getParseException()
public java.lang.String getMimeType()
public java.lang.String getParameter(java.lang.String name)
name
- the name of the parameter to get.null
if not set.public java.util.Map<java.lang.String,java.lang.String> getParameters()
public boolean isMimeType(java.lang.String mimeType)
mimeType
- the MIME type to match against.true
if the MIME type of this field matches,
false
otherwise.public boolean isMultipart()
multipart/*
.true
if this field is has a
multipart/*
MIME type, false
otherwise.public java.lang.String getBoundary()
boundary
parameter if set.boundary
parameter value or null
if not set.public java.lang.String getCharset()
charset
parameter if set.charset
parameter value or null
if not set.public static java.lang.String getMimeType(ContentTypeField child, ContentTypeField parent)
null
or hasn't got a
MIME type value set. If child's MIME type is multipart but no boundary
has been set the MIME type of child will be derived from the parent.child
- the child.parent
- the parent.public static java.lang.String getCharset(ContentTypeField f)
charset
parameter if set for the
given field. Returns the default us-ascii
if not set or if
f
is null
.charset
parameter value.Copyright © 2004-2016. All Rights Reserved.