Get the total number of unread messages in this Folder. This method can be invoked on a closed folder. However, note that for some folder implementations, getting the unread message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose n
()
| 779 | * @exception MessagingException for other failures |
| 780 | */ |
| 781 | public synchronized int getUnreadMessageCount() |
| 782 | throws MessagingException { |
| 783 | if (!isOpen()) |
| 784 | return -1; |
| 785 | |
| 786 | int unread = 0; |
| 787 | int total = getMessageCount(); |
| 788 | for (int i = 1; i <= total; i++) { |
| 789 | try { |
| 790 | if (!getMessage(i).isSet(Flags.Flag.SEEN)) |
| 791 | unread++; |
| 792 | } catch (MessageRemovedException me) { |
| 793 | // This is an expunged message, ignore it. |
| 794 | continue; |
| 795 | } |
| 796 | } |
| 797 | return unread; |
| 798 | } |
| 799 | |
| 800 | /** |
| 801 | * Get the number of deleted messages in this Folder. <p> |
nothing calls this directly
no test coverage detected