Package org.apache.james.mime4j.message
Class AbstractMultipart
java.lang.Object
org.apache.james.mime4j.message.AbstractMultipart
- All Implemented Interfaces:
Body
,Disposable
,Multipart
- Direct Known Subclasses:
MultipartImpl
Abstract MIME multipart body.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMultipart
(String subType, List<NameValuePair> contentTypeParameters) Creates a new emptyMultipart
instance. -
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.void
dispose()
Disposes of the BodyParts of this Multipart.Gets the list of body parts.int
getCount()
Returns the number of body parts.abstract String
Gets the epilogue or null if the message has no epilogueGets the parent of this body.abstract String
Gets 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.abstract void
setEpilogue
(String epilogue) Sets the epilogue value, or remove it if the value passed is null.void
Sets the parent of this body.abstract void
setPreamble
(String preamble) Sets the preamble with a value or null to remove the preamble.void
setSubType
(String subType) Sets the multipart sub-type.
-
Field Details
-
bodyParts
-
parent
-
subType
-
contentTypeParameters
-
-
Constructor Details
-
AbstractMultipart
Creates a new emptyMultipart
instance.
-
-
Method Details
-
getSubType
Gets the multipart sub-type. E.g.alternative
(the default) orparallel
. See RFC 2045 for common sub-types and their meaning.- Specified by:
getSubType
in interfaceMultipart
- 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.
-
getParent
Description copied from interface:Body
Gets the parent of this body. -
setParent
Description copied from interface:Body
Sets the parent of this body. -
getCount
public int getCount()Returns the number of body parts. -
getBodyParts
Gets the list of body parts. The list is immutable.- Specified by:
getBodyParts
in interfaceMultipart
- Returns:
- the list of
Entity
objects.
-
setBodyParts
Sets the list of body parts.- Specified by:
setBodyParts
in interfaceMultipart
- Parameters:
bodyParts
- the new list ofEntity
objects.
-
addBodyPart
Adds a body part to the end of the list of body parts.- Specified by:
addBodyPart
in interfaceMultipart
- Parameters:
bodyPart
- the body part.
-
addBodyPart
Inserts a body part at the specified position in the list of body parts.- Specified by:
addBodyPart
in interfaceMultipart
- 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.- Specified by:
removeBodyPart
in interfaceMultipart
- 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.- Specified by:
replaceBodyPart
in interfaceMultipart
- 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
Gets the preamble or null if the message has no preamble.- Specified by:
getPreamble
in interfaceMultipart
- Returns:
- the preamble.
-
setPreamble
Sets the preamble with a value or null to remove the preamble.- Specified by:
setPreamble
in interfaceMultipart
- Parameters:
preamble
- the preamble.
-
getEpilogue
Gets the epilogue or null if the message has no epilogue- Specified by:
getEpilogue
in interfaceMultipart
- Returns:
- the epilogue.
-
setEpilogue
Sets the epilogue value, or remove it if the value passed is null.- Specified by:
setEpilogue
in interfaceMultipart
- Parameters:
epilogue
- the epilogue.
-
getContentTypeParameters
- Specified by:
getContentTypeParameters
in interfaceMultipart
-
dispose
public void dispose()Disposes of the BodyParts of this Multipart. Note that the dispose call does not get forwarded to the parent entity of this Multipart.- Specified by:
dispose
in interfaceDisposable
- See Also:
-