Module com.sun.xml.messaging.saaj
Class MimePartDataSource
java.lang.Object
com.sun.xml.messaging.saaj.packaging.mime.internet.MimePartDataSource
- All Implemented Interfaces:
jakarta.activation.DataSource
A utility class that implements a DataSource out of
a MimeBodyPart. This class is primarily meant for service providers.
-
Constructor Summary
ConstructorDescriptionConstructor, that constructs a DataSource from a MimeBodyPart. -
Method Summary
Modifier and TypeMethodDescriptionReturns the content-type of this DataSource.Returns an input stream from this MimeBodyPart.getName()
DataSource method to return a name.DataSource method to return an output stream.
-
Constructor Details
-
MimePartDataSource
Constructor, that constructs a DataSource from a MimeBodyPart.- Parameters:
part
- body part
-
-
Method Details
-
getInputStream
Returns an input stream from this MimeBodyPart.This method applies the appropriate transfer-decoding, based on the Content-Transfer-Encoding attribute of this MimeBodyPart. Thus the returned input stream is a decoded stream of bytes.
This implementation obtains the raw content from the MimeBodyPart using the
getContentStream()
method and decodes it using theMimeUtility.decode()
method.- Specified by:
getInputStream
in interfacejakarta.activation.DataSource
- Returns:
- decoded input stream
- Throws:
IOException
-
getOutputStream
DataSource method to return an output stream.This implementation throws the UnknownServiceException.
- Specified by:
getOutputStream
in interfacejakarta.activation.DataSource
- Throws:
IOException
-
getContentType
Returns the content-type of this DataSource.This implementation just invokes the
getContentType
method on the MimeBodyPart.- Specified by:
getContentType
in interfacejakarta.activation.DataSource
-
getName
DataSource method to return a name.This implementation just returns an empty string.
- Specified by:
getName
in interfacejakarta.activation.DataSource
-