JavaScript is disabled on your browser.
javax.mail

Class Multipart

  • Direct Known Subclasses:
    MimeMultipart


    public abstract class Multipart
    extends java.lang.Object
    A multipart is a container for multiple body parts.

    Some messaging systems provide different subtypes of multiparts. For example, MIME specifies a set of subtypes that include "alternative", "mixed", "related", "parallel", "signed", etc.

    • Field Summary

      Fields
      Modifier and Type Field and Description
      protected java.lang.String contentType
      The content-type of this multipart object.
      protected Part parent
      The part containing this multipart, if known.
      protected java.util.Vector parts
      Vector of body parts.
    • Constructor Summary

      Constructors
      Modifier Constructor and Description
      protected Multipart ()
      Constructor for an empty multipart of type "multipart/mixed".
    • Method Summary

      Methods
      Modifier and Type Method and Description
      void addBodyPart (BodyPart part)
      Adds a body part to this multipart.
      void addBodyPart (BodyPart part, int index)
      Inserts a body part at the specified index.
      BodyPart getBodyPart (int index)
      Get the specified body part.
      java.lang.String getContentType ()
      Returns the content-type of this multipart.
      int getCount ()
      Returns the number of enclosed body parts.
      Part getParent ()
      Returns the part containing this multipart, or null if not known.
      boolean removeBodyPart (BodyPart part)
      Removes the specified body part from this multipart.
      void removeBodyPart (int index)
      Removes the body part at the specified index.
      protected void setMultipartDataSource (MultipartDataSource mp)
      Configures this multipart from the given data source.
      void setParent (Part part)
      Sets the parent of this multipart.
      abstract void writeTo (java.io.OutputStream os)
      Writes this multipart to the specified byte stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • parts

        protected java.util.Vector parts
        Vector of body parts.
      • contentType

        protected java.lang.String contentType
        The content-type of this multipart object. It defaults to "multipart/mixed".
      • parent

        protected Part parent
        The part containing this multipart, if known.
    • Constructor Detail

      • Multipart

        protected Multipart()
        Constructor for an empty multipart of type "multipart/mixed".
    • Method Detail

      • setMultipartDataSource

        protected void setMultipartDataSource(MultipartDataSource mp)
         throws MessagingException 
        Configures this multipart from the given data source.

        The method adds the body parts in the data source to this multipart, and sets the content-type.

        Parameters:
        mp - a multipart data source
        Throws:
        MessagingException
      • getContentType

        public java.lang.String getContentType()
        Returns the content-type of this multipart.
      • getBodyPart

        public BodyPart getBodyPart(int index)
         throws MessagingException 
        Get the specified body part. The body parts in this container are numbered starting at 0.
        Parameters:
        index - the index of the desired body part
        Throws:
        java.lang.IndexOutOfBoundsException - if the given index is out of range
        MessagingException
      • removeBodyPart

        public boolean removeBodyPart(BodyPart part)
         throws MessagingException 
        Removes the specified body part from this multipart.
        Parameters:
        part - the body part to remove
        Returns:
        true if a body part was removed, false otherwise
        Throws:
        MessagingException - if the multipart has not been configured
        IllegalWriteException - if the underlying implementation does not support modification of existing values
      • removeBodyPart

        public void removeBodyPart(int index)
         throws MessagingException 
        Removes the body part at the specified index. The body parts in this container are numbered starting at 0.
        Parameters:
        index - index of the part to remove
        Throws:
        java.lang.IndexOutOfBoundsException - if the given index is out of range
        IllegalWriteException - if the underlying implementation does not support modification of existing values
        MessagingException
      • addBodyPart

        public void addBodyPart(BodyPart part,
         int index)
         throws MessagingException 
        Inserts a body part at the specified index. The body parts in this container are numbered starting at 0.
        Parameters:
        part - the body part to be inserted
        index - where to insert the part
        Throws:
        IllegalWriteException - if the underlying implementation does not support modification of existing values
        MessagingException
      • writeTo

        public abstract void writeTo(java.io.OutputStream os)
         throws java.io.IOException,
         MessagingException 
        Writes this multipart to the specified byte stream.
        Throws:
        java.io.IOException
        MessagingException
      • getParent

        public Part getParent()
        Returns the part containing this multipart, or null if not known.
      • setParent

        public void setParent(Part part)
        Sets the parent of this multipart.

AltStyle によって変換されたページ (->オリジナル) /