Class DataSourceAttachment

    • Field Detail

      • dataSource

        protected final javax.activation.DataSource dataSource
        The data source providing the content.
    • Constructor Detail

      • DataSourceAttachment

        public DataSourceAttachment​(String name,
                                    String description,
                                    javax.activation.DataSource dataSource)
        Creates an attachment having the designated name and description retrieving the content from the designated data source. The content type is set to "application/octet-stream". This allows to override name and content type of the data source.
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        dataSource - The data source providing the content (only).
      • DataSourceAttachment

        public DataSourceAttachment​(javax.activation.DataSource dataSource,
                                    String description)
        Creates an attachment having the designated data source (content, name and content type).
        Parameters:
        dataSource - The data source providing the content (and the name and the content type).
        description - The description of the attachment.
      • DataSourceAttachment

        public DataSourceAttachment​(String name,
                                    String description,
                                    String contentType,
                                    javax.activation.DataSource dataSource)
        Creates an attachment having the designated name, description and content type retrieving the content from the designated data source. This allows to override name and content type of the data source.
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) of the attachment.
        dataSource - The data source providing the content (only).
      • DataSourceAttachment

        public DataSourceAttachment​(javax.activation.DataSource dataSource,
                                    String description,
                                    boolean inline)
        Creates an attachment having the designated data source (content, name and content type).
        Parameters:
        dataSource - The data source providing the content (and the name and the content type).
        description - The description of the attachment.
        inline - Whether to inline this attachment in case of an HTML message using the designated name.
      • DataSourceAttachment

        public DataSourceAttachment​(String name,
                                    String description,
                                    String contentType,
                                    javax.activation.DataSource dataSource,
                                    boolean inline)
        Creates an attachment having the designated name, description and content type retrieving the content from the designated data source. This allows to override name and content type of the data source.
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) of the attachment.
        dataSource - The data source providing the content (only).
        inline - Whether to inline this attachment in case of an HTML message using the designated name.
      • DataSourceAttachment

        public DataSourceAttachment​(javax.activation.DataSource dataSource,
                                    String description,
                                    String inlineName)
        Creates an attachment having the designated data source (content, name and content type).
        Parameters:
        dataSource - The data source providing the content (and the name and the content type).
        description - The description of the attachment.
        inlineName - The name used in the corresponding HTML message to refer to this attachment to be inlined. Use null to not inline the attachment.
      • DataSourceAttachment

        public DataSourceAttachment​(String name,
                                    String description,
                                    String contentType,
                                    javax.activation.DataSource dataSource,
                                    String inlineName)
        Creates an attachment having the designated name, description and content type retrieving the content from the designated data source. This allows to override name and content type of the data source.
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) of the attachment.
        dataSource - The data source providing the content (only).
        inlineName - The name used in the corresponding HTML message to refer to this attachment to be inlined. Use null to not inline the attachment.
    • Method Detail

      • getContent

        public InputStream getContent()
                               throws IOException
        Description copied from class: SerialisableAttachment
        Gets the content of the attachment represented as InputStream.
        Note that this should only be called by the receiving service since the InputStream cannot be serialised.
        Specified by:
        getContent in class SerialisableAttachment
        Returns:
        The actual data of the attachment. The caller is responsible for closing.
        Throws:
        IOException - If there are problems retrieving the content, for instance converting the transferred serialisable data to an InputStream, an IOException will be thrown.