gnu.mail.providers.maildir
Class MaildirFolder

java.lang.Object
  extended by javax.mail.Folder
      extended by gnu.mail.providers.maildir.MaildirFolder

public final class MaildirFolder
extends Folder

The folder class implementing a Maildir-format mailbox.

Author:
Chris Burdess

Field Summary
 
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
Constructor Summary
protected MaildirFolder(Store store, java.lang.String filename)
          Constructor.
protected MaildirFolder(Store store, java.lang.String filename, boolean root, boolean inbox)
          Constructor.
 
Method Summary
 void appendMessages(Message[] m)
          Appends messages to this folder.
 void close(boolean expunge)
          Closes this folder.
 boolean create(int type)
          Creates this folder in the store.
 boolean delete(boolean recurse)
          Deletes this folder.
 boolean exists()
          Indicates whether this folder exists.
 Message[] expunge()
          Expunges this folder.
 Folder getFolder(java.lang.String filename)
          Returns the subfolder of this folder with the specified name.
 java.lang.String getFullName()
          Returns the full name of this folder.
 Message getMessage(int msgnum)
          Returns the specified message number from this folder.
 int getMessageCount()
          Returns the number of messages in this folder.
 Message[] getMessages()
          Returns the messages in this folder.
 java.lang.String getName()
          Returns the name of this folder.
 int getNewMessageCount()
          Returns the number of new messages in this folder.
 Folder getParent()
          Returns the parent folder.
 Flags getPermanentFlags()
          Returns the permanent flags for this folder.
 char getSeparator()
          Returns the separator character.
 int getType()
          Returns the type of this folder.
 URLName getURLName()
          Return a URLName representing this folder.
 boolean hasNewMessages()
          Indicates whether this folder contains new messages.
 boolean isOpen()
          Indicates whether this folder is open.
 Folder[] list()
          Returns the subfolders of this folder.
 Folder[] list(java.lang.String pattern)
          Returns the subfolders of this folder matching the specified pattern.
 void open(int mode)
          Opens this folder.
 boolean renameTo(Folder folder)
          Renames this folder.
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, getDeletedMessageCount, getMessages, getMessages, getMode, getStore, getUnreadMessageCount, isSubscribed, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MaildirFolder

protected MaildirFolder(Store store,
                        java.lang.String filename,
                        boolean root,
                        boolean inbox)
Constructor.


MaildirFolder

protected MaildirFolder(Store store,
                        java.lang.String filename)
Constructor.

Method Detail

getName

public java.lang.String getName()
Returns the name of this folder.

Specified by:
getName in class Folder

getFullName

public java.lang.String getFullName()
Returns the full name of this folder.

Specified by:
getFullName in class Folder

getURLName

public URLName getURLName()
                   throws MessagingException
Return a URLName representing this folder.

Overrides:
getURLName in class Folder
Throws:
MessagingException

getType

public int getType()
            throws MessagingException
Returns the type of this folder.

Specified by:
getType in class Folder
Throws:
MessagingException - if a messaging error occurred

exists

public boolean exists()
               throws MessagingException
Indicates whether this folder exists.

Specified by:
exists in class Folder
Throws:
MessagingException - if a messaging error occurred

hasNewMessages

public boolean hasNewMessages()
                       throws MessagingException
Indicates whether this folder contains new messages.

Specified by:
hasNewMessages in class Folder
Throws:
MessagingException - if a messaging error occurred

open

public void open(int mode)
          throws MessagingException
Opens this folder. If the folder is opened for writing, a lock must be acquired on the mbox. If this fails a MessagingException is thrown.

Specified by:
open in class Folder
Parameters:
mode - open the Folder READ_ONLY or READ_WRITE
Throws:
MessagingException - if a messaging error occurred

close

public void close(boolean expunge)
           throws MessagingException
Closes this folder.

Specified by:
close in class Folder
Parameters:
expunge - if the folder is to be expunged before it is closed
Throws:
MessagingException - if a messaging error occurred

expunge

public Message[] expunge()
                  throws MessagingException
Expunges this folder. This deletes all the messages marked as deleted.

Specified by:
expunge in class Folder
Throws:
MessagingException - if a messaging error occurred

isOpen

public boolean isOpen()
Indicates whether this folder is open.

Specified by:
isOpen in class Folder

getPermanentFlags

public Flags getPermanentFlags()
Returns the permanent flags for this folder.

Specified by:
getPermanentFlags in class Folder

getMessageCount

public int getMessageCount()
                    throws MessagingException
Returns the number of messages in this folder.

Specified by:
getMessageCount in class Folder
Throws:
MessagingException - if a messaging error occurred

getNewMessageCount

public int getNewMessageCount()
                       throws MessagingException
Returns the number of new messages in this folder.

Overrides:
getNewMessageCount in class Folder
Throws:
MessagingException - if a messaging error occurred

getMessage

public Message getMessage(int msgnum)
                   throws MessagingException
Returns the specified message number from this folder.

Specified by:
getMessage in class Folder
Parameters:
msgnum - the message number
Throws:
MessagingException - if a messaging error occurred

getMessages

public Message[] getMessages()
                      throws MessagingException
Returns the messages in this folder.

Overrides:
getMessages in class Folder
Throws:
MessagingException - if a messaging error occurred

appendMessages

public void appendMessages(Message[] m)
                    throws MessagingException
Appends messages to this folder. Only MimeMessages within the array will be appended, as we don't know how to retrieve internet content for other kinds.

Specified by:
appendMessages in class Folder
Parameters:
m - an array of messages to be appended
Throws:
FolderNotFoundException - if this folder does not exist
MessagingException - if the append operation failed

getParent

public Folder getParent()
                 throws MessagingException
Returns the parent folder.

Specified by:
getParent in class Folder
Throws:
MessagingException

list

public Folder[] list()
              throws MessagingException
Returns the subfolders of this folder.

Overrides:
list in class Folder
Throws:
MessagingException

list

public Folder[] list(java.lang.String pattern)
              throws MessagingException
Returns the subfolders of this folder matching the specified pattern.

Specified by:
list in class Folder
Parameters:
pattern - the match pattern
Throws:
MessagingException

getSeparator

public char getSeparator()
                  throws MessagingException
Returns the separator character.

Specified by:
getSeparator in class Folder
Throws:
MessagingException

create

public boolean create(int type)
               throws MessagingException
Creates this folder in the store.

Specified by:
create in class Folder
Parameters:
type - the desired type of the folder
Throws:
MessagingException

delete

public boolean delete(boolean recurse)
               throws MessagingException
Deletes this folder.

Specified by:
delete in class Folder
Parameters:
recurse - delete any subfolders
Returns:
true if the folder is deleted successfully, false otherwise
Throws:
FolderNotFoundException - if this folder does not exist
MessagingException

renameTo

public boolean renameTo(Folder folder)
                 throws MessagingException
Renames this folder.

Specified by:
renameTo in class Folder
Parameters:
folder - a folder representing the new name for this folder
Returns:
true if the folder is renamed successfully, false otherwise
Throws:
FolderNotFoundException - if this folder does not exist
MessagingException

getFolder

public Folder getFolder(java.lang.String filename)
                 throws MessagingException
Returns the subfolder of this folder with the specified name.

Specified by:
getFolder in class Folder
Parameters:
filename - the name of the folder
Throws:
MessagingException


© Copyright 2003, 2004 The Free Software Foundation, All rights reserved