Interface Attachment

All Superinterfaces:
Serializable

public interface Attachment extends Serializable
Message attachment

Example:

 
        Attachment attachment =
        AttachmentFactory.getInstance().createAttachment("xyz",
                                                         "plain/text; charset=us-ascii",
                                                         "Attachment Content".getBytes("us-ascii"));
        message.addAttachment(attachment);
  
  

  • Method Details

    • getContentID

      String getContentID()
      Gets the content identifier associated with the attachment
      Returns:
      the content identifier
    • setContentID

      void setContentID(String contentId)
      Sets the content identifier associated with the attachment
      Parameters:
      contentId - the content identifier
    • getContentType

      String getContentType()
      Gets the attachment content type
      Returns:
      the content type
    • setContentType

      void setContentType(String contentType)
      Sets the attachment content type
      Parameters:
      contentType - the content type
    • getInputStream

      InputStream getInputStream() throws IOException
      Gets the attachment contents as an input stream
      Throws:
      IOException
    • getAsByteArray

      byte[] getAsByteArray() throws IOException
      Gets the attachment contents as a byte array
      Throws:
      IOException
    • getSize

      int getSize() throws IOException
      Gets the attachment contents size, measured in number of bytes
      Returns:
      the content size
      Throws:
      IOException
    • setTransferEncoding

      void setTransferEncoding(String encoding)
      Sets the transfer encoding for the attachment
      Parameters:
      encoding - A valid transfer encoding, complying to those values defined by http://www.iana.org/assignments/transfer-encodings/
    • getTransferEncoding

      String getTransferEncoding()
      Gets the transfer encoding for the attachment
      Returns:
      the transfer encoding
    • setPartName

      void setPartName(String name)
      Sets the MIME part name for the attachment
      Parameters:
      name - the part name
    • getPartName

      String getPartName()
      Gets the MIME part name for the attachment
      Returns:
      the part name, or null