Package org.apache.james.mime4j.dom
Interface Multipart
-
- All Superinterfaces:
Body
,Disposable
- All Known Implementing Classes:
AbstractMultipart
,MultipartImpl
public interface Multipart extends Body
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
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.List<Entity>
getBodyParts()
Gets the list of body parts.List<NameValuePair>
getContentTypeParameters()
int
getCount()
Returns the number of body parts.String
getEpilogue()
Gets the epilogue or null if the message has no epilogueString
getPreamble()
Gets the preamble or null if the message has no preamble.String
getSubType()
Gets the multipart sub-type.Entity
removeBodyPart(int index)
Removes the body part at the specified position in the list of body parts.Entity
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 Detail
-
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
List<Entity> getBodyParts()
Gets the list of body parts. The list is immutable.- Returns:
- the list of
Entity
objects.
-
setBodyParts
void setBodyParts(List<Entity> bodyParts)
Sets the list of body parts.- Parameters:
bodyParts
- the new list ofEntity
objects.
-
addBodyPart
void addBodyPart(Entity bodyPart)
Adds a body part to the end of the list of body parts.- Parameters:
bodyPart
- the body part.
-
addBodyPart
void addBodyPart(Entity bodyPart, int index)
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
Entity removeBodyPart(int index)
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
Entity replaceBodyPart(Entity bodyPart, int index)
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
void setPreamble(String preamble)
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
void setEpilogue(String epilogue)
Sets the epilogue value, or remove it if the value passed is null.- Parameters:
epilogue
- the epilogue.
-
getContentTypeParameters
List<NameValuePair> getContentTypeParameters()
-
-