Class MimePartDataSource

  • All Implemented Interfaces:
    jakarta.activation.DataSource, MessageAware
    Direct Known Subclasses:
    IMAPMultipartDataSource

    public class MimePartDataSource
    extends Object
    implements jakarta.activation.DataSource, MessageAware
    A utility class that implements a DataSource out of a MimePart. This class is primarily meant for service providers.
    Author:
    John Mani
    See Also:
    MimePart, DataSource
    • Field Detail

      • part

        protected MimePart part
        The MimePart that provides the data for this DataSource.
        Since:
        JavaMail 1.4
    • Constructor Detail

      • MimePartDataSource

        public MimePartDataSource​(MimePart part)
        Constructor, that constructs a DataSource from a MimePart.
        Parameters:
        part - the MimePart
    • Method Detail

      • getOutputStream

        public OutputStream getOutputStream()
                                     throws IOException
        DataSource method to return an output stream.

        This implementation throws the UnknownServiceException.

        Specified by:
        getOutputStream in interface jakarta.activation.DataSource
        Throws:
        IOException
      • getContentType

        public String getContentType()
        Returns the content-type of this DataSource.

        This implementation just invokes the getContentType method on the MimePart.

        Specified by:
        getContentType in interface jakarta.activation.DataSource
      • getName

        public String getName()
        DataSource method to return a name.

        This implementation just returns an empty string.

        Specified by:
        getName in interface jakarta.activation.DataSource
      • getMessageContext

        public MessageContext getMessageContext()
        Return the MessageContext for the current part.
        Specified by:
        getMessageContext in interface MessageAware
        Returns:
        the message context
        Since:
        JavaMail 1.1