Class AbstractEntityBuilder
java.lang.Object
org.apache.james.mime4j.internal.AbstractEntityBuilder
- Direct Known Subclasses:
BodyPartBuilder, Message.Builder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a field to the end of the list of fields.Clears all fields.booleancontainsField(String name) Returnstrueif there is at least one explicitly set field with the given name.getBody()Returns message body.Returns MIME character set encoding of this message.Returns transfer encoding of this message.Returns creation date of the content disposition of this message.Return disposition type of this message.Gets aFieldgiven a field name.<F extends Field>
FGets aFieldgiven a field name and of the given type.Gets the fields of this header.Gets allFields having the specified field name.Gets allFields having the specified field name and of the given type.Returns filename of the content disposition of this message.Returns MIME type of this message.Returns modification date of the content disposition of this message.Returns read date of the content disposition of this message.longgetSize()Returns size of the content disposition of this message.<F extends ParsedField>
FobtainField(String fieldName) removeFields(String name) Removes allFields having the specified field name.setBody(BinaryBody binaryBody) Sets binaryBody of this message.Sets body of this message.Sets body of this message.setBody(Message.Builder message) Sets body of this message.Sets body of this message.setBody(MultipartBuilder multipart) setBody(SingleBodyBuilder body) setContentDisposition(String dispositionType) Sets content disposition of this message to the specified disposition type.setContentDisposition(String dispositionType, String filename) Sets content disposition of this message to the specified disposition type and filename.setContentDisposition(String dispositionType, String filename, long size) Sets content disposition of this message to the specified values.setContentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate) Sets content disposition of this message to the specified values.setContentTransferEncoding(String contentTransferEncoding) Sets transfer encoding of this message.setContentType(String mimeType, NameValuePair... parameters) Sets transfer encoding of this message.Sets or replaces a field.
-
Field Details
-
fields
-
fieldMap
-
body
-
-
Constructor Details
-
AbstractEntityBuilder
public AbstractEntityBuilder()
-
-
Method Details
-
addField
Adds a field to the end of the list of fields.- Parameters:
field- the field to add.
-
getFields
-
getField
-
getField
Gets aFieldgiven a field name and of the given type. If there are multiple such fields defined in this header the first one will be returned.- Parameters:
name- the field name (e.g. From, Subject).clazz- the field class.- Returns:
- the field or
nullif none found.
-
containsField
Returnstrueif there is at least one explicitly set field with the given name.- Parameters:
name- the field name (e.g. From, Subject).- Returns:
trueif there is at least one explicitly set field with the given name,falseotherwise.
-
getFields
-
getFields
-
removeFields
Removes allFields having the specified field name.- Parameters:
name- the field name (e.g. From, Subject).
-
setField
Sets or replaces a field. This method is useful for header fields such as Subject or Message-ID that should not occur more than once in a message. If this builder does not already contain a header field of the same name as the given field then it is added to the end of the list of fields (same behavior asaddField(org.apache.james.mime4j.stream.Field)). Otherwise the first occurrence of a field with the same name is replaced by the given field and all further occurrences are removed.- Parameters:
field- the field to set.
-
clearFields
Clears all fields. -
obtainField
-
getMimeType
Returns MIME type of this message.- Returns:
- the MIME type or
nullif no MIME type has been set.
-
getCharset
Returns MIME character set encoding of this message.- Returns:
- the MIME character set encoding or
nullif no charset type has been set.
-
setContentType
Sets transfer encoding of this message.- Parameters:
mimeType- MIME type of this message the MIME type to use.parameters- content type parameters to use.
-
getContentTransferEncoding
Returns transfer encoding of this message.- Returns:
- the transfer encoding.
-
setContentTransferEncoding
Sets transfer encoding of this message.- Parameters:
contentTransferEncoding- transfer encoding to use.
-
getDispositionType
Return disposition type of this message.- Returns:
- the disposition type or
nullif no disposition type has been set.
-
setContentDisposition
Sets content disposition of this message to the specified disposition type. No filename, size or date parameters are included in the content disposition.- Parameters:
dispositionType- disposition type value (usuallyinlineorattachment).
-
setContentDisposition
Sets content disposition of this message to the specified disposition type and filename. No size or date parameters are included in the content disposition.- Parameters:
dispositionType- disposition type value (usuallyinlineorattachment).filename- filename parameter value ornullif the parameter should not be included.
-
setContentDisposition
public AbstractEntityBuilder setContentDisposition(String dispositionType, String filename, long size) Sets content disposition of this message to the specified values. No date parameters are included in the content disposition.- Parameters:
dispositionType- disposition type value (usuallyinlineorattachment).filename- filename parameter value ornullif the parameter should not be included.size- size parameter value or-1if the parameter should not be included.
-
setContentDisposition
public AbstractEntityBuilder setContentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate) Sets content disposition of this message to the specified values.- Parameters:
dispositionType- disposition type value (usuallyinlineorattachment).filename- filename parameter value ornullif the parameter should not be included.size- size parameter value or-1if the parameter should not be included.creationDate- creation-date parameter value ornullif the parameter should not be included.modificationDate- modification-date parameter value ornullif the parameter should not be included.readDate- read-date parameter value ornullif the parameter should not be included.
-
getFilename
Returns filename of the content disposition of this message.- Returns:
- the filename parameter of the content disposition or
nullif the filename has not been set.
-
getSize
public long getSize()Returns size of the content disposition of this message.- Returns:
- the size parameter of the content disposition or
-1if the filename has not been set.
-
getCreationDate
Returns creation date of the content disposition of this message.- Returns:
- the creation date parameter of the content disposition or
nullif the filename has not been set.
-
getModificationDate
Returns modification date of the content disposition of this message.- Returns:
- the modification date parameter of the content disposition or
nullif the filename has not been set.
-
getReadDate
Returns read date of the content disposition of this message.- Returns:
- the read date parameter of the content disposition or
nullif the filename has not been set.
-
setBody
Sets body of this message. Also sets the content type based on properties of the givenBody.- Parameters:
body- the body.
-
setBody
- Throws:
IOException
-
setBody
Sets body of this message. Also sets the content type based on properties of the givenBody.- Parameters:
textBody- the body.
-
setBody
Sets binaryBody of this message. Also sets the content type based on properties of the givenBody.- Parameters:
binaryBody- the binaryBody.
-
setBody
Sets body of this message. Also sets the content type based on properties of the givenMessage.- Parameters:
message- the body.
-
setBody
-
setBody
Sets body of this message. Also sets the content type based on properties of the givenMultipart.- Parameters:
multipart- the body.
-
setBody
-
getBody
-