public class FileBackedMimeBodyPart
extends javax.mail.internet.MimeBodyPart
Constructor and Description |
---|
FileBackedMimeBodyPart(File file)
Create a MimeBodyPart backed by the data in file.
|
FileBackedMimeBodyPart(InputStream content,
File file)
Create a MimeBodyPart backed by file based on the headers and
content data in content.
|
FileBackedMimeBodyPart(javax.mail.internet.InternetHeaders headers,
InputStream body,
File file)
Create a MimeBodyPart backed by file, with the headers
given in headers and body content taken from the stream body.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Close off the underlying shared streams and remove the backing file.
|
void |
writeTo(OutputStream out) |
addHeader, addHeaderLine, attachFile, attachFile, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setHeader, setText, setText, setText, updateHeaders
public FileBackedMimeBodyPart(File file) throws javax.mail.MessagingException, IOException
file
- file containing the body part.javax.mail.MessagingException
- an exception occurs parsing file.IOException
- an exception occurs accessing file.public FileBackedMimeBodyPart(InputStream content, File file) throws javax.mail.MessagingException, IOException
content
- an inputstream containing the body part.file
- a handle to the backing file to use for storage.javax.mail.MessagingException
- an exception occurs parsing the resulting body part in file.IOException
- an exception occurs accessing file or content.public FileBackedMimeBodyPart(javax.mail.internet.InternetHeaders headers, InputStream body, File file) throws javax.mail.MessagingException, IOException
headers
- headers for the body part.body
- internal content for the body part.file
- backing file to use.javax.mail.MessagingException
- if the body part can't be produced.IOException
- if there is an issue reading stream or writing to file.public void writeTo(OutputStream out) throws IOException, javax.mail.MessagingException
writeTo
in interface javax.mail.Part
writeTo
in class javax.mail.internet.MimeBodyPart
IOException
javax.mail.MessagingException
public void dispose() throws IOException
IOException
- if streams cannot be closed or the file cannot be deleted.Copyright © 2015. All rights reserved.