Package org.apache.james.mime4j.dom
Interface Multipart
- All Superinterfaces:
Body
,Disposable
- All Known Implementing Classes:
AbstractMultipart
,MultipartImpl
A MIME multipart body (as defined in RFC 2045). A multipart body has a ordered list of
body parts. The multipart body also has a preamble and epilogue. The preamble consists of
whatever characters appear before the first body part while the epilogue consists of whatever
characters come after the last body part.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBodyPart
(Entity bodyPart) Adds a body part to the end of the list of body parts.void
addBodyPart
(Entity bodyPart, int index) Inserts a body part at the specified position in the list of body parts.Gets the list of body parts.int
getCount()
Returns the number of body parts.Gets the epilogue or null if the message has no epilogueGets the preamble or null if the message has no 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.void
setBodyParts
(List<Entity> bodyParts) Sets the list of body parts.void
setEpilogue
(String epilogue) Sets the epilogue value, or remove it if the value passed is null.void
setPreamble
(String preamble) Sets the preamble with a value or null to remove the preamble.Methods inherited from interface org.apache.james.mime4j.dom.Disposable
dispose
-
Method Details
-
getSubType
String 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.
-
getCount
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.
-
setBodyParts
Sets the list of body parts.- Parameters:
bodyParts
- the new list ofEntity
objects.
-
addBodyPart
Adds a body part to the end of the list of body parts.- Parameters:
bodyPart
- the body part.
-
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.- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index > getCount()).
-
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.
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getCount()).
-
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
String getPreamble()Gets the preamble or null if the message has no preamble.- Returns:
- the preamble.
-
setPreamble
Sets the preamble with a value or null to remove the preamble.- Parameters:
preamble
- the preamble.
-
getEpilogue
String getEpilogue()Gets the epilogue or null if the message has no epilogue- Returns:
- the epilogue.
-
setEpilogue
Sets the epilogue value, or remove it if the value passed is null.- Parameters:
epilogue
- the epilogue.
-
getContentTypeParameters
List<NameValuePair> getContentTypeParameters()
-