Attachment

public interface Attachment

Represents an attachment file contained by an email message, archive, PDF document, or Outlook data file.

The Attachment interface defines the contract for accessing and manipulating attachment files in the GroupDocs.Viewer component. It provides methods to retrieve information such as file name, size, and content type of the attachment.

Example usage:


 try (Viewer viewer = new Viewer("document.eml")) {
     List attachments = viewer.getAttachments();

     // Use the attachments object for further operations
 }
 

Note: The default implementation of this interface is AttachmentImpl.

Methods

Method Description
getId() Retrieves the unique identifier of the attachment within the context of a single file that contains this attachment.
getFileName() Retrieves the file name of the attachment.
getFilePath() Retrieves the relative path of the attachment.
getSize() Retrieves the file size of the attachment in bytes.
getFileType() Retrieves the file type of the attachment.

getId()

public abstract String getId()

Retrieves the unique identifier of the attachment within the context of a single file that contains this attachment.

Returns: java.lang.String - the unique identifier of the attachment.

getFileName()

public abstract String getFileName()

Retrieves the file name of the attachment.

Returns: java.lang.String - the file name of the attachment.

getFilePath()

public abstract String getFilePath()

Retrieves the relative path of the attachment. The path can be in the format “folder/file.docx” when the file is located within a folder, or it can be the filename when the file is located in the root of an archive, an e-mail message, or a data file.

Returns: java.lang.String - the relative path of the attachment.

getSize()

public abstract long getSize()

Retrieves the file size of the attachment in bytes.

Returns: long - the file size of the attachment.

getFileType()

public abstract FileType getFileType()

Retrieves the file type of the attachment.

Returns: FileType - the file type of the attachment.