Class MimePartDataSource
- java.lang.Object
-
- com.sun.xml.messaging.saaj.packaging.mime.internet.MimePartDataSource
-
- All Implemented Interfaces:
jakarta.activation.DataSource
public final class MimePartDataSource extends Object implements jakarta.activation.DataSource
A utility class that implements a DataSource out of a MimeBodyPart. This class is primarily meant for service providers.- Author:
- John Mani
-
-
Constructor Summary
Constructors Constructor Description MimePartDataSource(MimeBodyPart part)
Constructor, that constructs a DataSource from a MimeBodyPart.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
Returns the content-type of this DataSource.InputStream
getInputStream()
Returns an input stream from this MimeBodyPart.String
getName()
DataSource method to return a name.OutputStream
getOutputStream()
DataSource method to return an output stream.
-
-
-
Constructor Detail
-
MimePartDataSource
public MimePartDataSource(MimeBodyPart part)
Constructor, that constructs a DataSource from a MimeBodyPart.- Parameters:
part
- body part
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
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
public OutputStream getOutputStream() throws IOException
DataSource method to return an output stream.This implementation throws the UnknownServiceException.
- Specified by:
getOutputStream
in interfacejakarta.activation.DataSource
- Throws:
IOException
-
getContentType
public String 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
public String getName()
DataSource method to return a name.This implementation just returns an empty string.
- Specified by:
getName
in interfacejakarta.activation.DataSource
-
-