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
 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.
 java.util.List<Entity> getBodyParts()
          Gets the list of body parts.
 int getCount()
          Returns the number of body parts.
 java.lang.String getEpilogue()
          Gets the epilogue or null if the message has no epilogue
 java.lang.String getPreamble()
          Gets the preamble or null if the message has no preamble.
 java.lang.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(java.util.List<Entity> bodyParts)
          Sets the list of body parts.
 void setEpilogue(java.lang.String epilogue)
          Sets the epilogue value, or remove it if the value passed is null.
 void setPreamble(java.lang.String preamble)
          Sets the preamble with a value or null to remove the preamble.
 
Methods inherited from interface org.apache.james.mime4j.dom.Body
getParent, setParent
 
Methods inherited from interface org.apache.james.mime4j.dom.Disposable
dispose
 

Method Detail

getSubType

java.lang.String getSubType()
Gets the multipart sub-type. E.g. alternative (the default) or parallel. 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

java.util.List<Entity> getBodyParts()
Gets the list of body parts. The list is immutable.

Returns:
the list of Entity objects.

setBodyParts

void setBodyParts(java.util.List<Entity> bodyParts)
Sets the list of body parts.

Parameters:
bodyParts - the new list of Entity 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:
java.lang.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:
java.lang.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:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getCount()).

getPreamble

java.lang.String getPreamble()
Gets the preamble or null if the message has no preamble.

Returns:
the preamble.

setPreamble

void setPreamble(java.lang.String preamble)
Sets the preamble with a value or null to remove the preamble.

Parameters:
preamble - the preamble.

getEpilogue

java.lang.String getEpilogue()
Gets the epilogue or null if the message has no epilogue

Returns:
the epilogue.

setEpilogue

void setEpilogue(java.lang.String epilogue)
Sets the epilogue value, or remove it if the value passed is null.

Parameters:
epilogue - the epilogue.


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.