Package org.apache.james.mime4j.field
Class ContentTypeFieldImpl
java.lang.Object
org.apache.james.mime4j.field.AbstractField
org.apache.james.mime4j.field.ContentTypeFieldImpl
- All Implemented Interfaces:
ContentTypeField
,ParsedField
,Field
Represents a
Content-Type
field.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private boolean
private ParseException
static final FieldParser
<ContentTypeField> private String
Fields inherited from class org.apache.james.mime4j.field.AbstractField
monitor, rawField
Fields inherited from interface org.apache.james.mime4j.dom.field.ContentTypeField
PARAM_BOUNDARY, PARAM_CHARSET, TYPE_MESSAGE_RFC822, TYPE_MULTIPART_DIGEST, TYPE_MULTIPART_PREFIX, TYPE_TEXT_PLAIN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the value of theboundary
parameter if set.Gets the value of thecharset
parameter if set.static String
Gets the value of thecharset
parameter if set for the given field.Gets the media type defined in this Content-Type field.Gets the MIME type defined in this Content-Type field.static 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 isnull
or hasn't got a MIME type value set.getParameter
(String name) Gets the value of a parameter.Gets all parameters.Returns the exception that was thrown by the field parser while parsing the field value.Gets the subtype defined in this Content-Type field.boolean
isMimeType
(String mimeType) Determines if the MIME type of this field matches the given one.boolean
Determines if the MIME type of this field ismultipart/*
.private void
parse()
Methods inherited from class org.apache.james.mime4j.field.AbstractField
getBody, getName, getNameLowerCase, getRaw, getRawField, isValidField, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.james.mime4j.dom.field.ContentTypeField
bodyDescriptionField
Methods inherited from interface org.apache.james.mime4j.stream.Field
getBody, getName, getNameLowerCase, getRaw
Methods inherited from interface org.apache.james.mime4j.dom.field.ParsedField
isValidField
-
Field Details
-
parsed
private boolean parsed -
mimeType
-
mediaType
-
subType
-
parameters
-
parseException
-
PARSER
-
-
Constructor Details
-
ContentTypeFieldImpl
ContentTypeFieldImpl(Field rawField, DecodeMonitor monitor)
-
-
Method Details
-
getParseException
Description copied from interface:ParsedField
Returns the exception that was thrown by the field parser while parsing the field value. The result isnull
if the field is valid and no errors were encountered.- Specified by:
getParseException
in interfaceParsedField
- Overrides:
getParseException
in classAbstractField
- Returns:
- the exception that was thrown by the field parser or
null
if the field is valid. - See Also:
-
getMimeType
Description copied from interface:ContentTypeField
Gets the MIME type defined in this Content-Type field.- Specified by:
getMimeType
in interfaceContentTypeField
- Returns:
- the MIME type or an empty string if not set.
- See Also:
-
getMediaType
Description copied from interface:ContentTypeField
Gets the media type defined in this Content-Type field.- Specified by:
getMediaType
in interfaceContentTypeField
- See Also:
-
getSubType
Description copied from interface:ContentTypeField
Gets the subtype defined in this Content-Type field.- Specified by:
getSubType
in interfaceContentTypeField
- See Also:
-
getParameter
Description copied from interface:ContentTypeField
Gets the value of a parameter. Parameter names are case-insensitive.- Specified by:
getParameter
in interfaceContentTypeField
- Parameters:
name
- the name of the parameter to get.- Returns:
- the parameter value or
null
if not set. - See Also:
-
getParameters
Description copied from interface:ContentTypeField
Gets all parameters.- Specified by:
getParameters
in interfaceContentTypeField
- Returns:
- the parameters.
- See Also:
-
isMimeType
Description copied from interface:ContentTypeField
Determines if the MIME type of this field matches the given one.- Specified by:
isMimeType
in interfaceContentTypeField
- Parameters:
mimeType
- the MIME type to match against.- Returns:
true
if the MIME type of this field matches,false
otherwise.- See Also:
-
isMultipart
public boolean isMultipart()Description copied from interface:ContentTypeField
Determines if the MIME type of this field ismultipart/*
.- Specified by:
isMultipart
in interfaceContentTypeField
- Returns:
true
if this field is has amultipart/*
MIME type,false
otherwise.- See Also:
-
getBoundary
Description copied from interface:ContentTypeField
Gets the value of theboundary
parameter if set.- Specified by:
getBoundary
in interfaceContentTypeField
- Returns:
- the
boundary
parameter value ornull
if not set. - See Also:
-
getCharset
Description copied from interface:ContentTypeField
Gets the value of thecharset
parameter if set.- Specified by:
getCharset
in interfaceContentTypeField
- Returns:
- the
charset
parameter value ornull
if not set. - See Also:
-
getMimeType
Gets the MIME type defined in the child's Content-Type field or derives a MIME type from the parent if child isnull
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.- Parameters:
child
- the child.parent
- the parent.- Returns:
- the MIME type.
-
getCharset
Gets the value of thecharset
parameter if set for the given field. Returns the defaultus-ascii
if not set or iff
isnull
.- Returns:
- the
charset
parameter value.
-
parse
private void parse()
-