java.lang.Object
i2p.susi.webmail.Attachment
Represents an email attachment with metadata and file data.
Field Summary
Modifier and TypeFieldDescriptionprivate static final AtomicIntegerUnique per-process id, used as the attachment id in the compose UI.private final StringMIME content type of the attachment.private final FileThe file containing the attachment data.private final StringSuggested file name for the attachment.final intThe id of this attachment, unique per process.private final StringMIME transfer encoding of the attachment.Constructor Summary
ConstructorsConstructorDescriptionAttachment(String name, String type, String encoding, File data) Reference a file to be attached to an email.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidDelete the data file.booleanCompares this attachment to another for equality.The MIME content type of the attachment.getData()Returns an input stream for reading the attachment data.The attachment's suggested file name.getPath()Returns the absolute path to the data file.longgetSize()The unencoded size.The MIME transfer encoding of the attachment data.inthashCode()Returns a hash code based on the file name and data file.
Field Details
_nextId
Unique per-process id, used as the attachment id in the compose UI.id
public final int idThe id of this attachment, unique per process.fileName
Suggested file name for the attachment.contentType
MIME content type of the attachment.transferEncoding
MIME transfer encoding of the attachment.data
The file containing the attachment data.
Constructor Details
Attachment
Method Details
getFileName
getTransferEncoding
The MIME transfer encoding of the attachment data.- Returns:
- the transfer encoding, non-null
getContentType
The MIME content type of the attachment.- Returns:
- the content type, or null if the part had no Content-Type header
getData
Returns an input stream for reading the attachment data.- Returns:
- an input stream for reading the attachment data
- Throws:
IOException- if the file cannot be opened for reading
getPath
Returns the absolute path to the data file.- Returns:
- absolute path to the data file
getSize
public long getSize()The unencoded size.- Returns:
- the unencoded size
deleteData
public void deleteData()Delete the data file.hashCode
equals