Folders can contain Messages, other Folders or both, thus providing a tree-like hierarchy rooted at the Store's default folder. (Note that some Folder implementations may not allow both Messages and other Folders in the same Folder).
The interpretation of folder names is implementation dependent. The different levels of hierarchy in a folder's full name are separated from each other by the hierarchy delimiter character.
The case-insensitive full folder name (that is, the full name relative to the default folder for a Store) INBOX is reserved to mean the "primary folder for this user on this server". Not all Stores will provide an INBOX folder, and not all users will have an INBOX folder at all times. The name INBOX is reserved to refer to this folder, when it exists, in Stores that provide it.
A Folder object obtained from a Store need not actually exist
in the backend store. The exists method tests whether
the folder exists or not. The create method
creates a Folder.
A Folder is initially in the closed state. Certain methods are valid
in this state; the documentation for those methods note this. A
Folder is opened by calling its 'open' method. All Folder methods,
except open, delete and
renameTo, are valid in this state.
The only way to get a Folder is by invoking the
getFolder method on Store, Folder, or Session, or by invoking
the list or listSubscribed methods
on Folder. Folder objects returned by the above methods are not
cached by the Store. Thus, invoking the getFolder method
with the same folder name multiple times will return distinct Folder
objects. Likewise for the list and listSubscribed
methods.
The Message objects within the Folder are cached by the Folder.
Thus, invoking getMessage(msgno) on the same message number
multiple times will return the same Message object, until an
expunge is done on this Folder.
Message objects from a Folder are only valid while a Folder is open and should not be accessed after the Folder is closed, even if the Folder is subsequently reopened. Instead, new Message objects must be fetched from the Folder after the Folder is reopened.
Note that a Message's message number can change within a session if the containing Folder is expunged using the expunge method. Clients that use message numbers as references to messages should be aware of this and should be prepared to deal with this situation (probably by flushing out existing message number references and reloading them). Because of this complexity, it is better for clients to use Message objects as references to messages, rather than message numbers. Expunged Message objects still have to be pruned, but other Message objects in that folder are not affected by the expunge.
| Modifier and Type | Field and Description |
|---|---|
| private volatile Vector | |
| private volatile Vector | |
| public static final int | HOLDS_FOLDERS
This folder can contain other folders |
| public static final int | HOLDS_MESSAGES
This folder can contain messages |
| private volatile Vector | |
| private volatile Vector | |
| protected int | mode
The open mode of this folder. |
| private final EventQueue | |
| public static final int | READ_ONLY
The Folder is read only. |
| public static final int | READ_WRITE
The state and contents of this folder can be modified. |
| protected Store | store
The parent store. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addConnectionListener(ConnectionListener
the Listener for Connection events l)Add a listener for Connection events on this Folder. |
| public synchronized void | addFolderListener(FolderListener
the Listener for Folder events l)Add a listener for Folder events on this Folder. |
| public synchronized void | addMessageChangedListener(MessageChangedListener
the Listener for MessageChanged events l)Add a listener for MessageChanged events on this Folder. |
| public synchronized void | addMessageCountListener(MessageCountListener
the Listener for MessageCount events l)Add a listener for MessageCount events on this Folder. |
| public abstract void | |
| public abstract void | |
| public void | |
| public void | copyMessages(Message[]
the array of message objects msgs, Folder the folder to copy the messages to folder)Copy the specified Messages from this Folder into another Folder. |
| public abstract boolean | Returns: true if the creation succeeds, else false.The type of this folder. type)Create this folder on the Store. |
| public abstract boolean | Returns: true if the Folder is deleted successfullyalso delete subfolders? recurse)Delete this Folder. |
| public abstract boolean | Returns: true if the folder exists, otherwise falseTests if this folder physically exists on the Store. |
| public abstract Message[] | Returns: array of expunged Message objectsExpunge (permanently remove) messages marked DELETED. |
| public void | fetch(Message[]
fetch items for these messages msgs, FetchProfile the FetchProfile fp)Prefetch the items specified in the FetchProfile for the given Messages. |
| protected void | finalize()
Overrides java. |
| public synchronized int | Returns: number of deleted messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.Get the number of deleted messages in this Folder. |
| public abstract Folder | |
| public abstract String | |
| public abstract Message | Returns: the Message objectthe message number msgnum)Get the Message object corresponding to the given message number. |
| public abstract int | Returns: total number of messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.Get total number of messages in this Folder. |
| public synchronized Message[] | Returns: the Message objectsthe number of the first message start, int the number of the last message end)Get the Message objects for message numbers ranging from start through end, both start and end inclusive. |
| public synchronized Message[] | Returns: the array of Message objects.the array of message numbers msgnums)Get the Message objects for message numbers specified in the array. |
| public synchronized Message[] | Returns: array of Message objects, empty array if folder is empty.Get all Message objects from this Folder. |
| public synchronized int | |
| public abstract String | |
| public synchronized int | Returns: number of new messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.Get the number of new messages in this Folder. |
| public abstract Folder | |
| public abstract Flags | Returns: permanent flags, or null if not knownGet the permanent flags supported by this Folder. |
| public abstract char | Returns: Hierarchy separator characterReturn the delimiter character that separates this Folder's pathname from the names of immediate subfolders. |
| public Store | |
| public abstract int | Returns: integer with appropriate bits setReturns the type of this Folder, that is, whether this folder can hold messages or subfolders or both. |
| public synchronized int | Returns: total number of unread messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.Get the total number of unread messages in this Folder. |
| public URLName | |
| public abstract boolean | Returns: true if the Store has new MessagesReturns true if this Folder has new messages since the last time this indication was reset. |
| public abstract boolean | Returns: true if this Folder is in the 'open' state.Indicates whether this Folder is in the 'open' state. |
| public boolean | |
| public abstract Folder[] | |
| public Folder[] | Returns: array of Folder objects under this Folder. An empty array is returned if no subfolders exist.Convenience method that returns the list of folders under this Folder. |
| public Folder[] | Returns: array of matching subscribed Folder objects. An empty array is returned if no matching subscribed folders exist.the match pattern pattern)Returns a list of subscribed Folders belonging to this Folder's namespace that match the specified pattern. |
| public Folder[] | Returns: array of subscribed Folder objects under this Folder. An empty array is returned if no subscribed subfolders exist.Convenience method that returns the list of subscribed folders under this Folder. |
| protected void | |
| protected void | notifyFolderListeners(int
type of FolderEvent type)Notify all FolderListeners registered on this Folder and this folder's Store. |
| protected void | notifyFolderRenamedListeners(Folder
Folder representing the new name. folder)Notify all FolderListeners registered on this Folder and this folder's Store about the renaming of this folder. |
| protected void | notifyMessageAddedListeners(Message[]
the messages that were added msgs)Notify all MessageCountListeners about the addition of messages into this folder. |
| protected void | notifyMessageChangedListeners(int
the MessageChangedEvent type type, Message the message that changed msg)Notify all MessageChangedListeners. |
| protected void | notifyMessageRemovedListeners(boolean
was the message removed by this client? removed, Message[] the messages that were removed msgs)Notify all MessageCountListeners about the removal of messages from this Folder. |
| public abstract void | |
| private void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public abstract boolean | |
| public Message[] | Returns: array of matching messagesthe search criterion term)Search this Folder for messages matching the specified search criterion. |
| public Message[] | Returns: array of matching messagesthe search criterion term, Message[] the messages to be searched msgs)Search the given array of messages for those that match the specified search criterion. |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public void | setSubscribed(boolean
true to subscribe, false to unsubscribe subscribe)Subscribe or unsubscribe this Folder. |
| public String | toString()
Overrides java. |