O'Reilly logo

Java Enterprise in a Nutshell, Second Edition by David Flanagan, Jim Farley, William Crawford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required