org.apache.james.mime4j.message
Class Multipart

java.lang.Object
  extended by org.apache.james.mime4j.message.Multipart
All Implemented Interfaces:
Body

public class Multipart
extends java.lang.Object
implements Body

Represents a MIME multipart body (see 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.

Version:
$Id: Multipart.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $

Constructor Summary
Multipart(java.lang.String subType)
          Creates a new empty Multipart instance.
 
Method Summary
 void addBodyPart(BodyPart bodyPart)
          Adds a body part to the end of the list of body parts.
 java.util.List getBodyParts()
          Gets the list of body parts.
 java.lang.String getEpilogue()
          Gets the epilogue.
 Entity getParent()
          Gets the parent of this body.
 java.lang.String getPreamble()
          Gets the preamble.
 java.lang.String getSubType()
          Gets the multipart sub-type.
 void setBodyParts(java.util.List bodyParts)
          Sets the list of body parts.
 void setEpilogue(java.lang.String epilogue)
          Sets the epilogue.
 void setParent(Entity parent)
          Sets the parent of this body.
 void setPreamble(java.lang.String preamble)
          Sets the preamble.
 void setSubType(java.lang.String subType)
          Sets the multipart sub-type.
 void writeTo(java.io.OutputStream out, int mode)
          Write the Multipart to the given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Multipart

public Multipart(java.lang.String subType)
Creates a new empty Multipart instance.

Method Detail

getSubType

public 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.

setSubType

public void setSubType(java.lang.String subType)
Sets the multipart sub-type. E.g. alternative or parallel. See RFC 2045 for common sub-types and their meaning.

Parameters:
subType - the sub-type.

getParent

public Entity getParent()
Description copied from interface: Body
Gets the parent of this body.

Specified by:
getParent in interface Body
Returns:
the parent.
See Also:
Body.getParent()

setParent

public void setParent(Entity parent)
Description copied from interface: Body
Sets the parent of this body.

Specified by:
setParent in interface Body
Parameters:
parent - the parent.
See Also:
Body.setParent(org.apache.james.mime4j.message.Entity)

getEpilogue

public java.lang.String getEpilogue()
Gets the epilogue.

Returns:
the epilogue.

setEpilogue

public void setEpilogue(java.lang.String epilogue)
Sets the epilogue.

Parameters:
epilogue - the epilogue.

getBodyParts

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

Returns:
the list of BodyPart objects.

setBodyParts

public void setBodyParts(java.util.List bodyParts)
Sets the list of body parts.

Parameters:
bodyParts - the new list of BodyPart objects.

addBodyPart

public void addBodyPart(BodyPart bodyPart)
Adds a body part to the end of the list of body parts.

Parameters:
bodyPart - the body part.

getPreamble

public java.lang.String getPreamble()
Gets the preamble.

Returns:
the preamble.

setPreamble

public void setPreamble(java.lang.String preamble)
Sets the preamble.

Parameters:
preamble - the preamble.

writeTo

public void writeTo(java.io.OutputStream out,
                    int mode)
             throws java.io.IOException,
                    MimeException
Write the Multipart to the given OutputStream.

Specified by:
writeTo in interface Body
Parameters:
out - the OutputStream to write to
mode - compatibility mode
Throws:
java.io.IOException - if case of an I/O error
MimeException - if case of a MIME protocol violation


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