Package io.jmix.imap.impl
Class ImapAttachmentsImpl
java.lang.Object
io.jmix.imap.impl.ImapAttachmentsImpl
- All Implemented Interfaces:
ImapAttachments
@Component("imap_ImapAttachments")
public class ImapAttachmentsImpl
extends Object
implements ImapAttachments
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ImapDataProviderprotected ImapHelperprotected Metadataprotected TimeSource -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ImapMessageAttachmentcreateImapMessageAttachment(int i, javax.mail.BodyPart bodyPart) protected StringdecodeAttachmentName(String encodedName) Sometimes email clients encode filenames according to the RFC6266 standard.fetchAttachments(ImapMessage message) Retrieve and cache attachments for messagebyte[]loadFile(ImapMessageAttachment attachment) Load a file message attachment content into byte array.protected Collection<ImapMessageAttachment>makeAttachments(com.sun.mail.imap.IMAPMessage msg) openStream(ImapMessageAttachment attachment) Return an input stream to load a message attachment content
-
Field Details
-
imapHelper
-
imapDataProvider
-
timeSource
-
metadata
-
-
Constructor Details
-
ImapAttachmentsImpl
public ImapAttachmentsImpl()
-
-
Method Details
-
fetchAttachments
Description copied from interface:ImapAttachmentsRetrieve and cache attachments for message- Specified by:
fetchAttachmentsin interfaceImapAttachments- Parameters:
message- reference object for IMAP message- Returns:
- reference objects for message attachments
-
makeAttachments
protected Collection<ImapMessageAttachment> makeAttachments(com.sun.mail.imap.IMAPMessage msg) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
decodeAttachmentName
Sometimes email clients encode filenames according to the RFC6266 standard. This method resolve this problem- Parameters:
encodedName- encoded attachment name- Returns:
- name of attachment
-
createImapMessageAttachment
protected ImapMessageAttachment createImapMessageAttachment(int i, javax.mail.BodyPart bodyPart) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
openStream
Description copied from interface:ImapAttachmentsReturn an input stream to load a message attachment content- Specified by:
openStreamin interfaceImapAttachments- Parameters:
attachment- IMAP message attachment reference object- Returns:
- input stream, must be closed after use
-
loadFile
Description copied from interface:ImapAttachmentsLoad a file message attachment content into byte array.- Specified by:
loadFilein interfaceImapAttachments- Parameters:
attachment- IMAP message attachment reference object- Returns:
- attachment content
-