File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes How to displaly progress bar for downloading attachment Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "How to displaly progress bar for downloading attachment" Watch "How to displaly progress bar for downloading attachment" New topic
Author

How to displaly progress bar for downloading attachment

Ralf Nowak
Greenhorn

Joined: Feb 01, 2012
Posts: 2
I display the progress bar for downloading attachments and it works fine … but when I am downloading some attachments I get the exception message:
Exception in thread "main" com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed 4 valid base64 characters but only got 1 before EOF, the 10 most recent characters were: "Q3w5ilxj2P"


I found the explanation:
Certain IMAP servers do not implement the IMAP Partial FETCH functionality properly. This problem typically manifests as corrupt email attachments when downloading large messages from the IMAP server. To workaround this server bug, set the "mail.imap.partialfetch" property to false. You'll have to set this property in the Properties object that you provide to your Session.

http://java.sun.com/products/javamail/NOTES113.txt

So I turned off partial fetch:


this solved the problem ….however the method getInputStream() from the Part class blocks the thread until the attachment is completely downloaded and it is impossible to get the information about the number of bytes which have been already downloaded from mailbox. Without this information it is impossible to display the progress bar. So is there a way to obtain this information and display the progress bar?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

Hi Ralf, I notice that you crossposted this question in the Oracle Java forums. Could you please read our FAQ page at the link BeForthrightWhenCrossPostingToOtherSites?

(And really, if you don't get an answer from Bill Shannon over there then chances are nobody else will have an answer either.)
Ralf Nowak
Greenhorn

Joined: Feb 01, 2012
Posts: 2
Hi Paul, thanks for the information.

I asked the question not only on the Oracle Java forum:
http://stackoverflow.com/questions/9086700/how-to-displaly-progress-bar-for-downloading-attachment
https://forums.oracle.com/forums/thread.jspa?messageID=10118944
http://www.daniweb.com/software-development/java/threads/409635/1748155
http://www.programmingforums.org/post225617.html
http://www.codeproject.com/Messages/4144860/How-to-displaly-progress-bar-for-downloading-attac.aspx
 
 
subject: How to displaly progress bar for downloading attachment
 
Threads others viewed
IMAP/TLS Problem in connecting using java mail api.
Javamail IMAP connection to exchange just hangs
proxy problem
IMAP /TLS standalone programm works fine, in Tomcat fails.
error in retrieving mail through a proxy.
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture