Package org.apache.james.mime4j.message
Class BodyPartBuilder
java.lang.Object
org.apache.james.mime4j.internal.AbstractEntityBuilder
org.apache.james.mime4j.message.BodyPartBuilder
BodyPart
builder.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a field to the end of the list of fields.build()
static BodyPartBuilder
create()
removeFields
(String name) Removes allField
s having the specified field name.Sets binary content of this message with the given MIME type.Sets text of this message with the given MIME subtype and charset.Sets text of this message with the charset.setBody
(BinaryBody binaryBody) Sets binaryBody of this message.Sets body of this message.Sets body of this message.Sets body of this message.Sets body of this message.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.use
(BodyFactory bodyFactory) SetsBodyFactory
that will be used to generate message body.Methods inherited from class org.apache.james.mime4j.internal.AbstractEntityBuilder
clearFields, containsField, getBody, getCharset, getContentTransferEncoding, getCreationDate, getDispositionType, getField, getField, getFields, getFields, getFields, getFilename, getMimeType, getModificationDate, getReadDate, getSize, obtainField, setBody, setBody, setBody
-
Field Details
-
bodyFactory
-
-
Constructor Details
-
BodyPartBuilder
public BodyPartBuilder()
-
-
Method Details
-
create
-
use
SetsBodyFactory
that will be used to generate message body.- Parameters:
bodyFactory
- body factory.
-
setField
Description copied from class:AbstractEntityBuilder
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 asAbstractEntityBuilder.addField(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.- Overrides:
setField
in classAbstractEntityBuilder
- Parameters:
field
- the field to set.
-
addField
Description copied from class:AbstractEntityBuilder
Adds a field to the end of the list of fields.- Overrides:
addField
in classAbstractEntityBuilder
- Parameters:
field
- the field to add.
-
removeFields
Description copied from class:AbstractEntityBuilder
Removes allField
s having the specified field name.- Overrides:
removeFields
in classAbstractEntityBuilder
- Parameters:
name
- the field name (e.g. From, Subject).
-
setContentTransferEncoding
Description copied from class:AbstractEntityBuilder
Sets transfer encoding of this message.- Overrides:
setContentTransferEncoding
in classAbstractEntityBuilder
- Parameters:
contentTransferEncoding
- transfer encoding to use.
-
setContentType
Description copied from class:AbstractEntityBuilder
Sets transfer encoding of this message.- Overrides:
setContentType
in classAbstractEntityBuilder
- Parameters:
mimeType
- MIME type of this message the MIME type to use.parameters
- content type parameters to use.
-
setContentDisposition
Description copied from class:AbstractEntityBuilder
Sets content disposition of this message to the specified disposition type. No filename, size or date parameters are included in the content disposition.- Overrides:
setContentDisposition
in classAbstractEntityBuilder
- Parameters:
dispositionType
- disposition type value (usuallyinline
orattachment
).
-
setContentDisposition
Description copied from class:AbstractEntityBuilder
Sets content disposition of this message to the specified disposition type and filename. No size or date parameters are included in the content disposition.- Overrides:
setContentDisposition
in classAbstractEntityBuilder
- Parameters:
dispositionType
- disposition type value (usuallyinline
orattachment
).filename
- filename parameter value ornull
if the parameter should not be included.
-
setContentDisposition
Description copied from class:AbstractEntityBuilder
Sets content disposition of this message to the specified values. No date parameters are included in the content disposition.- Overrides:
setContentDisposition
in classAbstractEntityBuilder
- Parameters:
dispositionType
- disposition type value (usuallyinline
orattachment
).filename
- filename parameter value ornull
if the parameter should not be included.size
- size parameter value or-1
if the parameter should not be included.
-
setContentDisposition
public BodyPartBuilder setContentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate) Description copied from class:AbstractEntityBuilder
Sets content disposition of this message to the specified values.- Overrides:
setContentDisposition
in classAbstractEntityBuilder
- Parameters:
dispositionType
- disposition type value (usuallyinline
orattachment
).filename
- filename parameter value ornull
if the parameter should not be included.size
- size parameter value or-1
if the parameter should not be included.creationDate
- creation-date parameter value ornull
if the parameter should not be included.modificationDate
- modification-date parameter value ornull
if the parameter should not be included.readDate
- read-date parameter value ornull
if the parameter should not be included.
-
setBody
Description copied from class:AbstractEntityBuilder
Sets body of this message. Also sets the content type based on properties of the givenBody
.- Overrides:
setBody
in classAbstractEntityBuilder
- Parameters:
body
- the body.
-
setBody
Description copied from class:AbstractEntityBuilder
Sets body of this message. Also sets the content type based on properties of the givenBody
.- Overrides:
setBody
in classAbstractEntityBuilder
- Parameters:
textBody
- the body.
-
setBody
Description copied from class:AbstractEntityBuilder
Sets binaryBody of this message. Also sets the content type based on properties of the givenBody
.- Overrides:
setBody
in classAbstractEntityBuilder
- Parameters:
binaryBody
- the binaryBody.
-
setBody
Description copied from class:AbstractEntityBuilder
Sets body of this message. Also sets the content type based on properties of the givenMultipart
.- Overrides:
setBody
in classAbstractEntityBuilder
- Parameters:
multipart
- the body.
-
setBody
Description copied from class:AbstractEntityBuilder
Sets body of this message. Also sets the content type based on properties of the givenMessage
.- Overrides:
setBody
in classAbstractEntityBuilder
- Parameters:
message
- the body.
-
setBody
Sets text of this message with the charset.- Parameters:
text
- the text.charset
- the charset of the text.- Throws:
IOException
-
setBody
Sets text of this message with the given MIME subtype and charset.- Parameters:
text
- the text.subtype
- the text subtype (e.g. "plain", "html" or "xml").charset
- the charset of the text.- Throws:
IOException
-
setBody
Sets binary content of this message with the given MIME type.- Parameters:
bin
- the body.mimeType
- the MIME media type of the specified body ("type/subtype").- Throws:
IOException
-
build
-