Java Code Examples for javax.activation.DataHandler#getDataSource()

The following examples show how to use javax.activation.DataHandler#getDataSource() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: commons-email   File: MimeMessageParser.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Parses the MimePart to create a DataSource.
 *
 * @param parent the parent multi-part
 * @param part   the current part to be processed
 * @return the DataSource
 * @throws MessagingException creating the DataSource failed
 * @throws IOException        creating the DataSource failed
 */
protected DataSource createDataSource(final Multipart parent, final MimePart part)
    throws MessagingException, IOException
{
    final DataHandler dataHandler = part.getDataHandler();
    final DataSource dataSource = dataHandler.getDataSource();
    final String contentType = getBaseMimeType(dataSource.getContentType());
    final byte[] content = this.getContent(dataSource.getInputStream());
    final ByteArrayDataSource result = new ByteArrayDataSource(content, contentType);
    final String dataSourceName = getDataSourceName(part, dataSource);

    result.setName(dataSourceName);
    return result;
}
 
Example 2
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 3
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 4
Source Project: jdk8u60   File: Base64Data.java    License: GNU General Public License v2.0 4 votes vote down vote up
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 5
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 6
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 7
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 8
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 9
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 10
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 11
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 12
Source Project: hottub   File: Base64Data.java    License: GNU General Public License v2.0 4 votes vote down vote up
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 13
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 14
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 15
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}
 
Example 16
FilterDataHandler(DataHandler dh) {
    super(dh.getDataSource());
}
 
Example 17
public DataSourceSource(DataHandler dh) throws MimeTypeParseException {
    this(dh.getDataSource());
}