public class Attachment extends MimeMessage
MimeMessage
.
Example Usage:
Attachment att = new Attachment(new File("c:/tmp/image.gif"));
Constructor and Description |
---|
Attachment(byte[] data)
Constructs a new
Attachment instance. |
Attachment(java.io.File file)
Constructs a new
Attachment instance. |
Attachment(java.io.File file,
java.lang.String characterEncoding)
Constructs a new
Attachment instance. |
Attachment(MimeMessage message)
Constructs a new
Attachment instance from an existing MIME message. |
Attachment(java.lang.String filename,
byte[] data)
Constructs a new
Attachment instance. |
Attachment(java.lang.String filename,
byte[] data,
java.lang.String characterEncoding)
Constructs a new
Attachment instance. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentEncoding()
Gets Content-transfer-encoding header value for this
Attachment . |
java.lang.String |
getContentType()
Gets content-type for this
Attachment . |
byte[] |
getFileData()
Gets decoded content of this
Attachment . |
java.lang.String |
getFilename()
Gets filename field contained in Content-Disposition header attribute
for this
Attachment . |
void |
setContentEncoding(java.lang.String ce)
Sets Content-Transfer-Encoding header for this
Attachment . |
void |
setContentType(java.lang.String contentType)
Sets Content-Type header for this
Attachment . |
addHeader, addHeader, addPart, addReplaceHeader, addReplaceHeader, getBody, getBodyAsFile, getBodyData, getBoundary, getContentTransferEncoding, getHeader, getHeaders, getHeaders, getHeaderValue, getMessage, getPart, getParts, getRawBodyData, removeHeader, removePart, removeParts, setBody, setBody, setBody, setBody, setBodyAsFile
public Attachment(java.io.File file, java.lang.String characterEncoding) throws java.io.IOException, MimeException
Attachment
instance.file
- the file to be attachedcharacterEncoding
- the character encoding of the attachment
filenamejava.io.IOException
- if an I/O error occursMimeException
- if a MIME related parsing error occurspublic Attachment(java.io.File file) throws java.io.IOException, MimeException
Attachment
instance.file
- the file to be attachedjava.io.IOException
- if an I/O error occursMimeException
- if a MIME related parsing error occurspublic Attachment(java.lang.String filename, byte[] data, java.lang.String characterEncoding) throws MimeException
Attachment
instance.filename
- the filename of the attachmentdata
- the byte[] data for attachmentcharacterEncoding
- the character encoding used in the filenameMimeException
- if a MIME related parsing error occurspublic Attachment(java.lang.String filename, byte[] data) throws MimeException
Attachment
instance.filename
- the filename of the attachmentdata
- the byte[] data for attachmentMimeException
- if a MIME related parsing error occurspublic Attachment(byte[] data) throws MimeException
Attachment
instance.data
- the body byte[] data for attachmentMimeException
- if a MIME related error occurspublic Attachment(MimeMessage message) throws MimeException
Attachment
instance from an existing MIME message.message
- the MimeMessageMimeException
- if a MIME related error occurspublic java.lang.String getContentType()
Attachment
.getContentType
in class MimeMessage
public void setContentType(java.lang.String contentType) throws MimeException
Attachment
.setContentType
in class MimeMessage
contentType
- the content-type for this Attachment
MimeException
- if a MIME related error occurspublic java.lang.String getContentEncoding()
Attachment
.null
if not foundpublic void setContentEncoding(java.lang.String ce) throws MimeException
Attachment
.ce
- the content-transfer-encodingMimeException
- if a MIME related error occurspublic java.lang.String getFilename()
Attachment
.public byte[] getFileData() throws java.lang.Exception
Attachment
.Attachment
java.lang.Exception
- if message could not be decodedCopyright © JSCAPE LLC. 1999-2021. All Rights Reserved