Fields Summary |
---|
public static final String | TYPE_MULTIPART_PREFIXThe prefix of all multipart MIME types. |
public static final String | TYPE_MULTIPART_DIGESTThe multipart/digest MIME type. |
public static final String | TYPE_TEXT_PLAINThe text/plain MIME type. |
public static final String | TYPE_MESSAGE_RFC822The message/rfc822 MIME type. |
public static final String | PARAM_BOUNDARYThe name of the boundary parameter. |
public static final String | PARAM_CHARSETThe name of the charset parameter. |
private String | mimeType |
private Map | parameters |
private org.apache.james.mime4j.field.contenttype.parser.ParseException | parseException |
Methods Summary |
---|
public java.lang.String | getBoundary()Gets the value of the boundary parameter if set.
return getParameter(PARAM_BOUNDARY);
|
public java.lang.String | getCharset()Gets the value of the charset parameter if set.
return getParameter(PARAM_CHARSET);
|
public static java.lang.String | getCharset(org.apache.james.mime4j.field.ContentTypeField f)Gets the value of the charset parameter if set for the
given field. Returns the default us-ascii if not set or if
f is null .
if (f != null) {
if (f.getCharset() != null && f.getCharset().length() > 0) {
return f.getCharset();
}
}
return "us-ascii";
|
public java.lang.String | getMimeType()Gets the MIME type defined in this Content-Type field.
return mimeType;
|
public static java.lang.String | getMimeType(org.apache.james.mime4j.field.ContentTypeField child, org.apache.james.mime4j.field.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.
If child's MIME type is multipart but no boundary
has been set the MIME type of child will be derived from
the parent.
if (child == null || child.getMimeType().length() == 0
|| child.isMultipart() && child.getBoundary() == null) {
if (parent != null && parent.isMimeType(TYPE_MULTIPART_DIGEST)) {
return TYPE_MESSAGE_RFC822;
} else {
return TYPE_TEXT_PLAIN;
}
}
return child.getMimeType();
|
public java.lang.String | getParameter(java.lang.String name)Gets the value of a parameter. Parameter names are case-insensitive.
return parameters != null
? (String) parameters.get(name.toLowerCase())
: null;
|
public java.util.Map | getParameters()Gets all parameters.
return parameters != null
? Collections.unmodifiableMap(parameters)
: Collections.EMPTY_MAP;
|
public 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.
return parseException;
|
public boolean | isMimeType(java.lang.String mimeType)Determines if the MIME type of this field matches the given one.
return this.mimeType.equalsIgnoreCase(mimeType);
|
public boolean | isMultipart()Determines if the MIME type of this field is multipart/* .
return mimeType.startsWith(TYPE_MULTIPART_PREFIX);
|