- java.lang.Object
- 
- jakarta.mail.internet.MimePartDataSource
 
- 
- All Implemented Interfaces:
- jakarta.activation.DataSource,- MessageAware
 
 public class MimePartDataSource extends java.lang.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
 
- 
- 
Constructor SummaryConstructors Constructor Description MimePartDataSource(MimePart part)Constructor, that constructs a DataSource from a MimePart.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()Returns the content-type of this DataSource.java.io.InputStreamgetInputStream()Returns an input stream from this MimePart.MessageContextgetMessageContext()Return theMessageContextfor the current part.java.lang.StringgetName()DataSource method to return a name.java.io.OutputStreamgetOutputStream()DataSource method to return an output stream.
 
- 
- 
- 
Field Detail- 
partprotected MimePart part The MimePart that provides the data for this DataSource.
 
- 
 - 
Constructor Detail- 
MimePartDataSourcepublic MimePartDataSource(MimePart part) Constructor, that constructs a DataSource from a MimePart.- Parameters:
- part- the MimePart
 
 
- 
 - 
Method Detail- 
getInputStreampublic java.io.InputStream getInputStream() throws java.io.IOExceptionReturns an input stream from this MimePart.This method applies the appropriate transfer-decoding, based on the Content-Transfer-Encoding attribute of this MimePart. Thus the returned input stream is a decoded stream of bytes. This implementation obtains the raw content from the Part using the getContentStream()method and decodes it using theMimeUtility.decode()method.- Specified by:
- getInputStreamin interface- jakarta.activation.DataSource
- Returns:
- decoded input stream
- Throws:
- java.io.IOException
- See Also:
- MimeMessage.getContentStream(),- MimeBodyPart.getContentStream(),- MimeUtility.decode(java.io.InputStream, java.lang.String)
 
 - 
getOutputStreampublic java.io.OutputStream getOutputStream() throws java.io.IOExceptionDataSource method to return an output stream.This implementation throws the UnknownServiceException. - Specified by:
- getOutputStreamin interface- jakarta.activation.DataSource
- Throws:
- java.io.IOException
 
 - 
getContentTypepublic java.lang.String getContentType() Returns the content-type of this DataSource.This implementation just invokes the getContentTypemethod on the MimePart.- Specified by:
- getContentTypein interface- jakarta.activation.DataSource
 
 - 
getNamepublic java.lang.String getName() DataSource method to return a name.This implementation just returns an empty string. - Specified by:
- getNamein interface- jakarta.activation.DataSource
 
 - 
getMessageContextpublic MessageContext getMessageContext() Return theMessageContextfor the current part.- Specified by:
- getMessageContextin interface- MessageAware
- Returns:
- the message context
 
 
- 
 
-