Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reporting progress on IMAP message download

843834Dec 30 2009 — edited Dec 31 2009
I'm trying to download a complete message with all headers and body content, and show a progress while the transfer is in progress.

I can't find any API giving access to progress information while fetching, so the best (ugly hack) solution I've come up with is using folder.doCommand() and swapping out the Protocol.input stream with a wrapped version while doing
fetch(msgNum, "body[]")
and then putting the unwrapped inputStream back after fetch using Reflection.

Then I create a new MimeMessage from the FetchResponse using the
new MimeMessage(session, inputstream)
constructor. The inputstream is retrieved from the
FetchResponse.getItem(0)).data
property. This stream contains the FETCH command on the first line and the ending ) on the last. I would like a clean inputstream with just the message content, and the ability to monitor the download progress. Please advice :)

Sincerely,
Edvin Syse
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 28 2010
Added on Dec 30 2009
5 comments
146 views