Methods Summary |
---|
public synchronized void | addBodyPart(javax.mail.BodyPart part)Adds a Part to the multipart. The BodyPart is appended to
the list of existing Parts.
if (parts == null)
parts = new Vector();
parts.addElement(part);
part.setParent(this);
|
public synchronized void | addBodyPart(javax.mail.BodyPart part, int index)Adds a BodyPart at position index .
If index is not the last one in the list,
the subsequent parts are shifted up. If index
is larger than the number of parts present, the
BodyPart is appended to the end.
if (parts == null)
parts = new Vector();
parts.insertElementAt(part, index);
part.setParent(this);
|
public synchronized javax.mail.BodyPart | getBodyPart(int index)Get the specified Part. Parts are numbered starting at 0.
if (parts == null)
throw new IndexOutOfBoundsException("No such BodyPart");
return (BodyPart)parts.elementAt(index);
|
public java.lang.String | getContentType()Return the content-type of this Multipart.
This implementation just returns the value of the
contentType field.
return contentType;
|
public synchronized int | getCount()Return the number of enclosed BodyPart objects.
if (parts == null)
return 0;
return parts.size();
|
public synchronized javax.mail.Part | getParent()Return the Part that contains this Multipart
object, or null if not known.
return parent;
|
public synchronized boolean | removeBodyPart(javax.mail.BodyPart part)Remove the specified part from the multipart message.
Shifts all the parts after the removed part down one.
if (parts == null)
throw new MessagingException("No such body part");
boolean ret = parts.removeElement(part);
part.setParent(null);
return ret;
|
public synchronized void | removeBodyPart(int index)Remove the part at specified location (starting from 0).
Shifts all the parts after the removed part down one.
if (parts == null)
throw new IndexOutOfBoundsException("No such BodyPart");
BodyPart part = (BodyPart)parts.elementAt(index);
parts.removeElementAt(index);
part.setParent(null);
|
protected synchronized void | setMultipartDataSource(javax.mail.MultipartDataSource mp)Setup this Multipart object from the given MultipartDataSource.
The method adds the MultipartDataSource's BodyPart
objects into this Multipart. This Multipart's contentType is
set to that of the MultipartDataSource.
This method is typically used in those cases where one
has a multipart data source that has already been pre-parsed into
the individual body parts (for example, an IMAP datasource), but
needs to create an appropriate Multipart subclass that represents
a specific multipart subtype.
contentType = mp.getContentType();
int count = mp.getCount();
for (int i = 0; i < count; i++)
addBodyPart(mp.getBodyPart(i));
|
public synchronized void | setParent(javax.mail.Part parent)Set the parent of this Multipart to be the specified
Part . Normally called by the Message
or BodyPart setContent(Multipart) method.
parent may be null if the
Multipart is being removed from its containing
Part .
this.parent = parent;
|
public abstract void | writeTo(java.io.OutputStream os)Output an appropriately encoded bytestream to the given
OutputStream. The implementation subclass decides the
appropriate encoding algorithm to be used. The bytestream
is typically used for sending.
|