[英]progress bar with apache common email
我正在使用apache 公共電子郵件庫發送電子郵件,如下
// Create the attachment
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("mypictures/john.jpg");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Picture of John");
attachment.setName("John");
// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.setHostName("mail.myserver.com");
email.addTo("jdoe@somewhere.org", "John Doe");
email.setFrom("me@apache.org", "Me");
email.setSubject("The picture");
email.setMsg("Here is the picture you wanted");
// add the attachment
email.attach(attachment);
// send the email
email.send();
我想顯示進度條,直到附加文件並發送。
我們該怎么辦?
我看不到可以通過commons-email進行回調的任何方法,它可以讓您知道已經轉換了多少數據,因此,除非您侵入了Apache Commons電子郵件本身,否則不會從庫本身收到通知。
我看到的另一種“模擬”方式是建立一些有關傳輸通常需要多長時間的知識,即通常每秒傳輸多少字節並將其用於進度對話框顯示。 但是,如果傳輸速度隨時間變化很大,或者應用程序使用不同的網絡連接類型,則很自然會導致進度欄中的信息不正確。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.