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
Modifier and TypeFieldDescriptionprotected ImapDataProvider
protected ImapHelper
protected Metadata
protected TimeSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ImapMessageAttachment
createImapMessageAttachment
(int i, jakarta.mail.BodyPart bodyPart) protected String
decodeAttachmentName
(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:ImapAttachments
Retrieve and cache attachments for message- Specified by:
fetchAttachments
in 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 jakarta.mail.MessagingException - Throws:
jakarta.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, jakarta.mail.BodyPart bodyPart) throws jakarta.mail.MessagingException - Throws:
jakarta.mail.MessagingException
-
openStream
Description copied from interface:ImapAttachments
Return an input stream to load a message attachment content- Specified by:
openStream
in interfaceImapAttachments
- Parameters:
attachment
- IMAP message attachment reference object- Returns:
- input stream, must be closed after use
-
loadFile
Description copied from interface:ImapAttachments
Load a file message attachment content into byte array.- Specified by:
loadFile
in interfaceImapAttachments
- Parameters:
attachment
- IMAP message attachment reference object- Returns:
- attachment content
-