Package com.sun.mail.imap
Class DefaultFolder
- java.lang.Object
-
- javax.mail.Folder
-
- com.sun.mail.imap.IMAPFolder
-
- com.sun.mail.imap.DefaultFolder
-
- All Implemented Interfaces:
ResponseHandler,java.lang.AutoCloseable,UIDFolder
public class DefaultFolder extends IMAPFolder
The default IMAP folder (root of the naming hierarchy).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.mail.imap.IMAPFolder
IMAPFolder.FetchProfileItem, IMAPFolder.ProtocolCommand
-
-
Field Summary
-
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, READ_ONLY, READ_WRITE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendMessages(Message[] msgs)Append the given messages into this folder.booleandelete(boolean recurse)Delete this folder.Message[]expunge()Expunge all messages marked as DELETED.FoldergetFolder(java.lang.String name)Get the named subfolder.java.lang.StringgetName()Get the name of this folder.FoldergetParent()Get this folder's parent.booleanhasNewMessages()Check whether this folder has new messages.Folder[]list(java.lang.String pattern)List all subfolders matching the specified pattern.Folder[]listSubscribed(java.lang.String pattern)List all subscribed subfolders matching the specified pattern.booleanrenameTo(Folder f)Rename this folder.-
Methods inherited from class com.sun.mail.imap.IMAPFolder
addACL, addMessageCountListener, addMessages, addRights, appendUIDMessages, close, copyMessages, copyUIDMessages, create, doCommand, doCommandIgnoreFailure, doOptionalCommand, exists, expunge, fetch, forceClose, getACL, getAttributes, getDeletedMessageCount, getFullName, getHighestModSeq, getMessage, getMessageByUID, getMessageCount, getMessages, getMessagesByUID, getMessagesByUID, getMessagesByUIDChangedSince, getNewMessageCount, getPermanentFlags, getQuota, getSeparator, getSortedMessages, getSortedMessages, getStatusItem, getType, getUID, getUIDNext, getUIDNotSticky, getUIDValidity, getUnreadMessageCount, handleResponse, id, idle, idle, isOpen, isSubscribed, listRights, moveMessages, moveUIDMessages, myRights, open, open, removeACL, removeRights, search, search, setFlags, setFlags, setFlags, setQuota, setSubscribed
-
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, close, getMessages, getMessages, getMode, getStore, getURLName, list, listSubscribed, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, toString
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:IMAPFolderGet the name of this folder.- Overrides:
getNamein classIMAPFolder- Returns:
- name of the Folder
-
getParent
public Folder getParent()
Description copied from class:IMAPFolderGet this folder's parent.- Overrides:
getParentin classIMAPFolder- Returns:
- Parent folder
-
list
public Folder[] list(java.lang.String pattern) throws MessagingException
Description copied from class:IMAPFolderList all subfolders matching the specified pattern.- Overrides:
listin classIMAPFolder- Parameters:
pattern- the match pattern- Returns:
- array of matching Folder objects. An empty array is returned if no matching Folders exist.
- Throws:
FolderNotFoundException- if this folder does not exist.MessagingException- for other failures- See Also:
Folder.listSubscribed(java.lang.String)
-
listSubscribed
public Folder[] listSubscribed(java.lang.String pattern) throws MessagingException
Description copied from class:IMAPFolderList all subscribed subfolders matching the specified pattern.- Overrides:
listSubscribedin classIMAPFolder- Parameters:
pattern- the match pattern- Returns:
- array of matching subscribed Folder objects. An empty array is returned if no matching subscribed folders exist.
- Throws:
FolderNotFoundException- if this folder does not exist.MessagingException- for other failures- See Also:
Folder.list(java.lang.String)
-
hasNewMessages
public boolean hasNewMessages() throws MessagingExceptionDescription copied from class:IMAPFolderCheck whether this folder has new messages.- Overrides:
hasNewMessagesin classIMAPFolder- Returns:
- true if the Store has new Messages
- Throws:
FolderNotFoundException- if this folder does not exist.MessagingException- for other failures
-
getFolder
public Folder getFolder(java.lang.String name) throws MessagingException
Description copied from class:IMAPFolderGet the named subfolder.- Overrides:
getFolderin classIMAPFolder- Parameters:
name- name of the Folder- Returns:
- Folder object
- Throws:
MessagingException- for failures
-
delete
public boolean delete(boolean recurse) throws MessagingExceptionDescription copied from class:IMAPFolderDelete this folder.- Overrides:
deletein classIMAPFolder- Parameters:
recurse- also delete subfolders?- Returns:
- true if the Folder is deleted successfully
- Throws:
FolderNotFoundException- if this folder does not existMessagingException- for other failures- See Also:
FolderEvent
-
renameTo
public boolean renameTo(Folder f) throws MessagingException
Description copied from class:IMAPFolderRename this folder.- Overrides:
renameToin classIMAPFolder- Parameters:
f- a folder representing the new name for this Folder- Returns:
- true if the Folder is renamed successfully
- Throws:
FolderNotFoundException- if this folder does not existMessagingException- for other failures- See Also:
FolderEvent
-
appendMessages
public void appendMessages(Message[] msgs) throws MessagingException
Description copied from class:IMAPFolderAppend the given messages into this folder.- Overrides:
appendMessagesin classIMAPFolder- Parameters:
msgs- array of Messages to be appended- Throws:
FolderNotFoundException- if this folder does not exist.MessagingException- if the append failed.
-
expunge
public Message[] expunge() throws MessagingException
Description copied from class:IMAPFolderExpunge all messages marked as DELETED.- Overrides:
expungein classIMAPFolder- Returns:
- array of expunged Message objects
- Throws:
FolderNotFoundException- if this folder does not existMessagingException- for other failures- See Also:
Message.isExpunged(),MessageCountEvent
-
-