Package org.apache.james.mime4j.message
Class MultipartBuilder
java.lang.Object
org.apache.james.mime4j.message.MultipartBuilder
Multipart
builder.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BodyFactory
private String
private List
<NameValuePair> private String
private String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBinaryPart
(byte[] bin, String mimeType) addBodyPart
(Entity bodyPart) Adds a body part to the end of the list of body parts.addBodyPart
(Entity bodyPart, int index) Inserts a body part at the specified position in the list of body parts.addBodyPart
(BodyPartBuilder bodyPart) addContentTypeParameter
(NameValuePair parameter) addTextPart
(String text, Charset charset) build()
static MultipartBuilder
create()
static MultipartBuilder
static MultipartBuilder
createCopy
(Multipart other) Gets the list of body parts.int
getCount()
Returns the number of body parts.Returns epilogue.Returns preamble.Gets the multipart sub-type.removeBodyPart
(int index) Removes the body part at the specified position in the list of body parts.replaceBodyPart
(Entity bodyPart, int index) Replaces the body part at the specified position in the list of body parts with the specified body part.setEpilogue
(String epilogue) Sets the epilogue.setPreamble
(String preamble) Sets the preamble.setSubType
(String subType) Sets the multipart sub-type.use
(BodyFactory bodyFactory)
-
Field Details
-
bodyParts
-
subType
-
preamble
-
epilogue
-
bodyFactory
-
parameters
-
-
Constructor Details
-
MultipartBuilder
private MultipartBuilder()
-
-
Method Details
-
create
-
createCopy
-
create
-
use
-
getSubType
Gets the multipart sub-type. E.g.alternative
(the default) orparallel
. See RFC 2045 for common sub-types and their meaning.- Returns:
- the multipart sub-type.
-
setSubType
Sets the multipart sub-type. E.g.alternative
orparallel
. See RFC 2045 for common sub-types and their meaning.- Parameters:
subType
- the sub-type.
-
getCount
public int getCount()Returns the number of body parts.- Returns:
- number of
Entity
objects.
-
getBodyParts
Gets the list of body parts. The list is immutable.- Returns:
- the list of
Entity
objects.
-
addBodyPart
Adds a body part to the end of the list of body parts.- Parameters:
bodyPart
- the body part.
-
addBodyPart
-
addBodyPart
Inserts a body part at the specified position in the list of body parts.- Parameters:
bodyPart
- the body part.index
- index at which the specified body part is to be inserted.
-
removeBodyPart
Removes the body part at the specified position in the list of body parts.- Parameters:
index
- index of the body part to be removed.- Returns:
- the removed body part.
-
replaceBodyPart
Replaces the body part at the specified position in the list of body parts with the specified body part.- Parameters:
bodyPart
- body part to be stored at the specified position.index
- index of body part to replace.- Returns:
- the replaced body part.
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getCount()).
-
getPreamble
Returns preamble.- Returns:
- the preamble.
-
setPreamble
Sets the preamble.- Parameters:
preamble
- the preamble.
-
getEpilogue
Returns epilogue.- Returns:
- the epilogue.
-
setEpilogue
Sets the epilogue.- Parameters:
epilogue
- the epilogue.
-
addContentTypeParameter
-
addTextPart
- Throws:
IOException
-
addBinaryPart
- Throws:
IOException
-
copy
-
build
-