public class Attachment extends AttachmentBase implements IPreferredTextEncodingProvider, IAttachment
Represents an e-mail attachment.
Constructor and Description |
---|
Attachment(InputStream contentStream,
ContentType contentType)
Initializes a new instance of the
Attachment class. |
Attachment(InputStream contentStream,
String name)
Initializes a new instance of the
Attachment class. |
Attachment(InputStream contentStream,
String name,
String mediaType)
Initializes a new instance of the
Attachment class. |
Attachment(String fileName)
Initializes a new instance of the
Attachment class. |
Attachment(String fileName,
ContentType contentType)
Initializes a new instance of the
Attachment class. |
Attachment(String fileName,
String mediaType)
Initializes a new instance of the
Attachment class. |
Attachment(URI uri,
String name,
String mediaType)
Initializes a new instance of the
Attachment class. |
Modifier and Type | Method and Description |
---|---|
static Attachment |
createAttachmentFromString(String content,
ContentType contentType)
Creates the attachment from string.
|
static Attachment |
createAttachmentFromString(String content,
String name)
Creates the attachment from string.
|
static Attachment |
createAttachmentFromString(String content,
String name,
Charset contentEncoding,
String mediaType)
Creates the attachment from string.
|
protected String |
generateContentId()
Generates the content id value.
|
ContentDisposition |
getContentDisposition()
Gets Content-Disposition header
|
String |
getName()
Gets or sets an attachment name
|
Charset |
getNameEncoding()
Gets or sets an encoding of attachment name
|
Charset |
getPreferredTextEncoding()
Gets or sets a preferred text encoding
|
boolean |
isEmbeddedMessage() |
boolean |
isUri()
Gets a value indicating whether attachment is URI-attachment.
|
void |
setName(String value)
Gets or sets an attachment name
|
void |
setNameEncoding(Charset value)
Gets or sets an encoding of attachment name
|
void |
setPreferredTextEncoding(Charset value)
Gets or sets a preferred text encoding
|
dispose, dispose, getContentId, getContentStream, getContentType, getEncodingFromContent, getHeaders, getTransferEncoding, save, save, setContentFromString, setContentId, setContentStream, setContentType, setTransferEncoding
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
save, save
public Attachment(String fileName)
Initializes a new instance of the Attachment
class.
fileName
- Name of the file.public Attachment(String fileName, String mediaType)
Initializes a new instance of the Attachment
class.
fileName
- Name of the file.mediaType
- Type media type name.public Attachment(String fileName, ContentType contentType)
Initializes a new instance of the Attachment
class.
fileName
- Name of the file.contentType
- The ContentType
(AttachmentBase.getContentType()
/AttachmentBase.setContentType(ContentType)
).public Attachment(InputStream contentStream, String name)
Initializes a new instance of the Attachment
class.
contentStream
- The content stream of attachment.name
- The attachment name.public Attachment(URI uri, String name, String mediaType)
Initializes a new instance of the Attachment
class.
uri
- The URI.name
- The attachment name.mediaType
- The media type name.public Attachment(InputStream contentStream, String name, String mediaType)
Initializes a new instance of the Attachment
class.
contentStream
- The content stream of attachment.name
- The attachment name.mediaType
- The media type name.public Attachment(InputStream contentStream, ContentType contentType)
Initializes a new instance of the Attachment
class.
contentStream
- The content stream of attachment.contentType
- The ContentType
(AttachmentBase.getContentType()
/AttachmentBase.setContentType(ContentType)
).public final boolean isEmbeddedMessage()
public final String getName()
Gets or sets an attachment name
getName
in interface IAttachment
public final void setName(String value)
Gets or sets an attachment name
setName
in interface IAttachment
public final Charset getNameEncoding()
Gets or sets an encoding of attachment name
public final void setNameEncoding(Charset value)
Gets or sets an encoding of attachment name
public final ContentDisposition getContentDisposition()
Gets Content-Disposition header
public final boolean isUri()
Gets a value indicating whether attachment is URI-attachment.
public final Charset getPreferredTextEncoding()
Gets or sets a preferred text encoding
getPreferredTextEncoding
in interface IPreferredTextEncodingProvider
public final void setPreferredTextEncoding(Charset value)
Gets or sets a preferred text encoding
setPreferredTextEncoding
in interface IPreferredTextEncodingProvider
public static Attachment createAttachmentFromString(String content, String name)
Creates the attachment from string.
content
- A string that represents the content of attachment.name
- The attachment name.public static Attachment createAttachmentFromString(String content, String name, Charset contentEncoding, String mediaType)
Creates the attachment from string.
content
- A string that represents the content of attachment.name
- The attachment name.contentEncoding
- The content encoding.mediaType
- The media type namepublic static Attachment createAttachmentFromString(String content, ContentType contentType)
Creates the attachment from string.
content
- A string that represents the content of attachment.contentType
- The ContentType
(AttachmentBase.getContentType()
/AttachmentBase.setContentType(ContentType)
).protected String generateContentId()
Generates the content id value.
generateContentId
in class AttachmentBase