Name
Folder
Synopsis
The Folder
class represents a folder containing mail
messages. All messages are retrieved from a message store (represented by a
Store
object) via a Folder
object.
Depending on the protocol in use, folders might contain additional folders
as well as messages. In these cases, naming and hierarchy are entirely
implementation dependent. The folder name INBOX
is
reserved for the primary folder for the current user.
Folder
objects can be retrieved via the getFolder()
method of Store
or Folder
, or
via the list()
and listSubscribed()
methods. Each call to these methods will return a distinct
Folder
object. Once a Folder
has
been retrieved, it must be opened (via the open()
method)
to retrieve messages. Message
objects are cached
at the level of the Folder
object.
Certain Folder
methods are not valid across all protocols.
For instance, the subscription methods (which allow applications to register
interest in a particular folder) are not supported by POP3 email but might be
supported by an NNTP news implementation that uses Folders to represent
newsgroups. Similarly, POP3 does not support the create()
,
renameTo()
and delete()
methods, as
POP3 doesn’t support nested folders.
public abstract class Folder { // Protected Constructors protected Folder( Store store); // Public Constants public static final int HOLDS_FOLDERS; // =2 public static final int HOLDS_MESSAGES; // =1 public static final int READ_ONLY; // =1 public static final int READ_WRITE; // =2 // Event Registration ...
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.