The folder class implementing the IMAP4rev1 mail protocol.
delimiter
protected char delimiter
messageCount
protected int messageCount
newMessageCount
protected int newMessageCount
path
protected String path
The folder path.
permanentFlags
protected Flags permanentFlags
subscribed
protected boolean subscribed
type
protected int type
The type of this folder(HOLDS_MESSAGES or HOLDS_FOLDERS).
uidValidity
protected long uidValidity
IMAPFolder
protected IMAPFolder(Store store,
String path)
Constructor.
IMAPFolder
protected IMAPFolder(Store store,
String path,
char delimiter)
Constructor.
IMAPFolder
protected IMAPFolder(Store store,
String path,
int type,
char delimiter)
Constructor.
appendMessages
public void appendMessages(Message[] messages)
throws MessagingException
Appends the specified set of messages to this folder.
Only MimeMessage
s are accepted.
close
public void close(boolean expunge)
throws MessagingException
Closes this folder.
- close in interface Folder
expunge
- if the folder is to be expunged before it is closed
MessagingException
- if a messaging error occurred
equals
public boolean equals(Object other)
fetch
public void fetch(Message[] messages,
FetchProfile fp)
throws MessagingException
IMAP fetch routine.
This executes the fetch for the specified message numbers
and updates the messages according to the message statuses returned.
getFullName
public String getFullName()
Returns the full path of this folder.
- getFullName in interface Folder
getMessage
public Message getMessage(int msgnum)
throws MessagingException
Returns the specified message number from this folder.
The message is only retrieved once from the server.
Subsequent getMessage() calls to the same message are cached.
Since POP3 does not provide a mechanism for retrieving only part of
the message(headers, etc), the entire message is retrieved.
- getMessage in interface Folder
MessagingException
- if a messaging error occurred
getMessageByUID
public Message getMessageByUID(long uid)
throws MessagingException
Get the Message corresponding to the given UID.
If no such message exists, null is returned.
- getMessageByUID in interface UIDFolder
uid
- UID for the desired message
getMessagesByUID
public Message[] getMessagesByUID(long start,
long end)
throws MessagingException
Get the Messages specified by the given range.
The special value LASTUID can be used for the end parameter
to indicate the last available UID.
- getMessagesByUID in interface UIDFolder
start
- start UIDend
- end UID
getMessagesByUID
public Message[] getMessagesByUID(long[] uids)
throws MessagingException
Get the Messages specified by the given array of UIDs.
If any UID is invalid, null is returned for that entry.
Note that the returned array will be of the same size as the specified
array of UIDs, and null entries may be present in the array to indicate
invalid UIDs.
- getMessagesByUID in interface UIDFolder
uids
- array of UIDs
getName
public String getName()
Returns the name of this folder.
- getName in interface Folder
getNewMessageCount
public int getNewMessageCount()
throws MessagingException
Returns the number of new messages in this folder.
- getNewMessageCount in interface Folder
MessagingException
- if a messaging error occurred
getPermanentFlags
public Flags getPermanentFlags()
Returns the permanent flags for this folder.
- getPermanentFlags in interface Folder
getQuota
public Quota[] getQuota()
throws MessagingException
Returns the quotas for this folder.
getSeparator
public char getSeparator()
throws MessagingException
Returns the path separator charcter.
- getSeparator in interface Folder
getUID
public long getUID(Message message)
throws MessagingException
Get the UID for the specified message.
Note that the message must belong to this folder.
Else NoSuchElementException is thrown.
- getUID in interface UIDFolder
message
- Message from this folder
- UID for this message
getUIDValidity
public long getUIDValidity()
throws MessagingException
Returns the UIDValidity value associated with this folder.
Clients typically compare this value against a UIDValidity value
saved from a previous session to insure that any cached UIDs not stale.
- getUIDValidity in interface UIDFolder
isOpen
public boolean isOpen()
Indicates whether this folder is open.
- isOpen in interface Folder
isSubscribed
public boolean isSubscribed()
Returns true if this Folder is subscribed.
This method can be invoked on a closed Folder.
The default implementation provided here just returns true.
- isSubscribed in interface Folder
listSubscribed
public Folder[] listSubscribed(String pattern)
throws MessagingException
Returns the subscribed subfolders for this folder.
- listSubscribed in interface Folder
setSubscribed
public void setSubscribed(boolean flag)
throws MessagingException
Subscribe or unsubscribe this Folder.
Not all Stores support subscription.
This method can be invoked on a closed Folder.
The implementation provided here just throws the
MethodNotSupportedException.
- setSubscribed in interface Folder