Class MultipartBuilder
java.lang.Object
org.apache.james.mime4j.message.MultipartBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BodyFactoryprivate Stringprivate List<NameValuePair> private Stringprivate 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 MultipartBuildercreate()static MultipartBuilderstatic MultipartBuildercreateCopy(Multipart other) Gets the list of body parts.intgetCount()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.alternativeorparallel. 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
Entityobjects.
-
getBodyParts
-
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
-
setPreamble
Sets the preamble.- Parameters:
preamble- the preamble.
-
getEpilogue
-
setEpilogue
Sets the epilogue.- Parameters:
epilogue- the epilogue.
-
addContentTypeParameter
-
addTextPart
- Throws:
IOException
-
addBinaryPart
- Throws:
IOException
-
copy
-
build
-