Class AbstractMultipart
java.lang.Object
org.apache.james.mime4j.message.AbstractMultipart
- All Implemented Interfaces:
Body, Disposable, Multipart
- Direct Known Subclasses:
MultipartImpl
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMultipart(String subType, List<NameValuePair> contentTypeParameters) Creates a new emptyMultipartinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBodyPart(Entity bodyPart) Adds a body part to the end of the list of body parts.voidaddBodyPart(Entity bodyPart, int index) Inserts a body part at the specified position in the list of body parts.voiddispose()Disposes of the BodyParts of this Multipart.Gets the list of body parts.intgetCount()Returns the number of body parts.abstract StringGets the epilogue or null if the message has no epilogueGets the parent of this body.abstract StringGets 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.voidsetBodyParts(List<Entity> bodyParts) Sets the list of body parts.abstract voidsetEpilogue(String epilogue) Sets the epilogue value, or remove it if the value passed is null.voidSets the parent of this body.abstract voidsetPreamble(String preamble) Sets the preamble with a value or null to remove the preamble.voidsetSubType(String subType) Sets the multipart sub-type.
-
Field Details
-
bodyParts
-
parent
-
subType
-
contentTypeParameters
-
-
Constructor Details
-
AbstractMultipart
Creates a new emptyMultipartinstance.
-
-
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:
getSubTypein interfaceMultipart- 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.
-
getParent
-
setParent
-
getCount
-
getBodyParts
Gets the list of body parts. The list is immutable.- Specified by:
getBodyPartsin interfaceMultipart- Returns:
- the list of
Entityobjects.
-
setBodyParts
Sets the list of body parts.- Specified by:
setBodyPartsin interfaceMultipart- Parameters:
bodyParts- the new list ofEntityobjects.
-
addBodyPart
Adds a body part to the end of the list of body parts.- Specified by:
addBodyPartin interfaceMultipart- Parameters:
bodyPart- the body part.
-
addBodyPart
Inserts a body part at the specified position in the list of body parts.- Specified by:
addBodyPartin 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:
removeBodyPartin 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:
replaceBodyPartin 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:
getPreamblein interfaceMultipart- Returns:
- the preamble.
-
setPreamble
Sets the preamble with a value or null to remove the preamble.- Specified by:
setPreamblein interfaceMultipart- Parameters:
preamble- the preamble.
-
getEpilogue
Gets the epilogue or null if the message has no epilogue- Specified by:
getEpiloguein interfaceMultipart- Returns:
- the epilogue.
-
setEpilogue
Sets the epilogue value, or remove it if the value passed is null.- Specified by:
setEpiloguein interfaceMultipart- Parameters:
epilogue- the epilogue.
-
getContentTypeParameters
- Specified by:
getContentTypeParametersin 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:
disposein interfaceDisposable- See Also:
-