Class SerialisableAttachment

    • Field Detail

      • name

        protected final String name
        The name of the attachment.
      • description

        protected final String description
        The description of the attachment.
      • contentType

        protected final String contentType
        The content type (MIME) of the attachment.
      • inlineName

        protected final String inlineName
        The name used in the corresponding HTML message to refer to this attachment. This name will be replaced within the message by the corresponding referenced to this attachment. null if the attachment should not be inlined.
    • Constructor Detail

      • SerialisableAttachment

        protected SerialisableAttachment​(String name,
                                         String description)
        Creates an attachment having the designated name and description. The content type is set to "application/octet-stream".
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
      • SerialisableAttachment

        protected SerialisableAttachment​(String name,
                                         String description,
                                         boolean inline)
        Creates an attachment having the designated name and description. The content type is set to "application/octet-stream".
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        inline - Whether to inline this attachment in case of an HTML message using the designated name.
      • SerialisableAttachment

        protected SerialisableAttachment​(String name,
                                         String description,
                                         String contentType)
        Creates an attachment having the designated name, description and content type (MIME).
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) of the attachment.
      • SerialisableAttachment

        protected SerialisableAttachment​(String name,
                                         String description,
                                         String contentType,
                                         boolean inline)
        Creates an attachment having the designated name, description and content type (MIME).
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) of the attachment.
        inline - Whether to inline this attachment in case of an HTML message using the designated name.
      • SerialisableAttachment

        protected SerialisableAttachment​(String name,
                                         String description,
                                         String contentType,
                                         String inlineName)
        Creates an attachment having the designated name, description and content type (MIME).
        Parameters:
        name - The name of the attachment.
        description - The description of the attachment.
        contentType - The content type (MIME) 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.
    • Method Detail

      • getName

        public String getName()
        Gets the name of the attachment.
        Returns:
        The name of the attachment.
      • getDescription

        public String getDescription()
        Gets the description of the attachment.
        Returns:
        The description of the attachment.
      • getContentType

        public String getContentType()
        Gets the content type (MIME) of the attachment.
        Returns:
        The content type (MIME) of the attachment.
      • getInlineName

        public String getInlineName()
        Gets the name used in the corresponding HTML message to refer to this attachment. This name will be replaced within the message by the corresponding referenced to this attachment. null if the attachment should not be inlined.
        Returns:
        The name used in the corresponding HTML message to refer to this attachment to be inlined, null to not inline the attachment.
      • getContent

        public abstract InputStream getContent()
                                        throws IOException
        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.
        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.