Class FileBackedMimeBodyPart
java.lang.Object
javax.mail.BodyPart
javax.mail.internet.MimeBodyPart
org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart
- All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part
public class FileBackedMimeBodyPart
extends javax.mail.internet.MimeBodyPart
-
Field Summary
Fields inherited from class javax.mail.internet.MimeBodyPart
content, contentStream, dh, headersFields inherited from class javax.mail.BodyPart
parentFields inherited from interface javax.mail.Part
ATTACHMENT, INLINE -
Constructor Summary
ConstructorsConstructorDescriptionFileBackedMimeBodyPart(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. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Close off the underlying shared streams and remove the backing file.voidwriteTo(OutputStream out) Methods inherited from class javax.mail.internet.MimeBodyPart
addHeader, addHeaderLine, 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, updateHeadersMethods inherited from class javax.mail.BodyPart
getParent
-
Constructor Details
-
FileBackedMimeBodyPart
Create a MimeBodyPart backed by the data in file.- Parameters:
file- file containing the body part.- Throws:
javax.mail.MessagingException- an exception occurs parsing file.IOException- an exception occurs accessing file.
-
FileBackedMimeBodyPart
public FileBackedMimeBodyPart(InputStream content, File file) throws javax.mail.MessagingException, IOException Create a MimeBodyPart backed by file based on the headers and content data in content.- Parameters:
content- an inputstream containing the body part.file- a handle to the backing file to use for storage.- Throws:
javax.mail.MessagingException- an exception occurs parsing the resulting body part in file.IOException- an exception occurs accessing file or content.
-
FileBackedMimeBodyPart
public FileBackedMimeBodyPart(javax.mail.internet.InternetHeaders headers, InputStream body, File file) throws javax.mail.MessagingException, IOException Create a MimeBodyPart backed by file, with the headers given in headers and body content taken from the stream body.- Parameters:
headers- headers for the body part.body- internal content for the body part.file- backing file to use.- Throws:
javax.mail.MessagingException- if the body part can't be produced.IOException- if there is an issue reading stream or writing to file.
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfacejavax.mail.Part- Overrides:
writeToin classjavax.mail.internet.MimeBodyPart- Throws:
IOExceptionjavax.mail.MessagingException
-
dispose
Close off the underlying shared streams and remove the backing file.- Throws:
IOException- if streams cannot be closed or the file cannot be deleted.
-