public final class MimePartDataSource extends Object implements DataSource
Constructor and Description |
---|
MimePartDataSource(MimeBodyPart part)
Constructor, that constructs a DataSource from a MimeBodyPart.
|
Modifier and Type | Method and 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.
|
public MimePartDataSource(MimeBodyPart part)
part
- body partpublic InputStream getInputStream() throws IOException
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 the MimeUtility.decode()
method.
getInputStream
in interface DataSource
IOException
- for failures creating the InputStreampublic OutputStream getOutputStream() throws IOException
This implementation throws the UnknownServiceException.
getOutputStream
in interface DataSource
IOException
- for failures creating the OutputStreampublic String getContentType()
This implementation just invokes the getContentType
method on the MimeBodyPart.
getContentType
in interface DataSource
public String getName()
This implementation just returns an empty string.
getName
in interface DataSource
Copyright © 2021 JBoss by Red Hat. All rights reserved.