Interface EMailAttachment
-
- All Superinterfaces:
javax.activation.DataSource
@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public interface EMailAttachment extends javax.activation.DataSource
This interface defines a set of methods that may be used to interact with an email message attachment.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getContentType()
Retrieves the content type for this attachment.byte[]
getData()
Retrieves the raw data for this attachment.java.lang.String
getDisposition()
Retrieves the disposition for this attachment.java.io.InputStream
getInputStream()
Retrieves an input stream that can be used to read the attachment data.java.lang.String
getName()
Retrieves the filename for this attachment.java.io.OutputStream
getOutputStream()
Throws anIOException
to indicate that it is not possible to write to this data source.boolean
isInline()
Indicates whether this attachment should have a disposition of "inline" rather than "attachment".java.lang.String
toString()
Retrieves a string representation of this email attachment.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Retrieves the filename for this attachment.- Specified by:
getName
in interfacejavax.activation.DataSource
- Returns:
- The filename for this attachment.
-
getContentType
java.lang.String getContentType()
Retrieves the content type for this attachment. Note that it may have been altered from the provided value (for example, to add the filename to it).- Specified by:
getContentType
in interfacejavax.activation.DataSource
- Returns:
- The content type for this attachment.
-
isInline
boolean isInline()
Indicates whether this attachment should have a disposition of "inline" rather than "attachment".- Returns:
true
if this attachment should have a disposition of "inline", orfalse
if this attachment should have a disposition of "attachment".
-
getDisposition
java.lang.String getDisposition()
Retrieves the disposition for this attachment. It will be one of "inline" or "attachment", based on the return value ofisInline()
.- Returns:
- The disposition for this attachment.
-
getData
byte[] getData()
Retrieves the raw data for this attachment. The content of the returned array must not be altered by the caller.- Returns:
- The raw data for this attachment.
-
getInputStream
java.io.InputStream getInputStream()
Retrieves an input stream that can be used to read the attachment data.- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- Returns:
- An input stream that can be used to read the attachment data.
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOException
Throws anIOException
to indicate that it is not possible to write to this data source.- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Returns:
- Nothing, because this method always throws an exception.
- Throws:
java.io.IOException
- To indicate that it is not possible to write to this data source.
-
toString
java.lang.String toString()
Retrieves a string representation of this email attachment.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this email attachment.
-
-