The folder class implementing a UNIX mbox-format mailbox.
acquireLock
public boolean acquireLock()
Locks this mailbox.
This uses a dotlock-like mechanism - see createNewFile().
If the directory containing the mbox
folder is not writable, we will not be able to open the mbox for
writing either.
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.
m
- an array of messages to be appended
close
public void close(boolean expunge)
throws MessagingException
Closes this folder.
- close in interface Folder
expunge
- if the folder is to be expunged before it is closed
MessagingException
- if a messaging error occurred
create
public boolean create(int type)
throws MessagingException
Creates this folder in the store.
- create in interface Folder
decodeFrom
public static String decodeFrom(String line)
Returns the specified line with any From_ line encoding removed.
fromLine
protected String fromLine(MboxMessage message)
throws MessagingException
Returns the From_ line for the specified mbox message.
If this does not already exist(the message was appended to the folder
since it was last opened), we will attempt to generate a suitable From_
line for it.
getFolder
public Folder getFolder(String name)
throws MessagingException
Returns the subfolder of this folder with the specified name.
- getFolder in interface Folder
getFullName
public String getFullName()
Returns the full name of this folder.
If the folder resides under the root hierarchy of this Store, the
returned name is relative to the root. Otherwise an absolute name,
starting with the hierarchy delimiter, is returned.
- getFullName in interface Folder
getName
public String getName()
Returns the name of this folder.
- getName in interface Folder
getPermanentFlags
public Flags getPermanentFlags()
Returns the permanent flags for this folder.
- getPermanentFlags in interface Folder
getSeparator
public char getSeparator()
throws MessagingException
Returns the separator character.
- getSeparator in interface Folder
isOpen
public boolean isOpen()
Indicates whether this folder is open.
- isOpen in interface Folder
list
public Folder[] list(String pattern)
throws MessagingException
Returns the subfolders of this folder matching the specified pattern.
- list in interface Folder
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.
- open in interface Folder
MessagingException
- if a messaging error occurred
releaseLock
public boolean releaseLock()
Unlocks this mailbox.
This deletes any associated lockfile if it exists. It returns false if
an existing lockfile could not be deleted.