|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Folder
gnu.mail.providers.imap.IMAPFolder
public class IMAPFolder
The folder class implementing the IMAP4rev1 mail protocol.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.mail.UIDFolder |
---|
UIDFolder.FetchProfileItem |
Field Summary | |
---|---|
protected char |
delimiter
|
protected int |
messageCount
|
protected int |
newMessageCount
|
protected java.lang.String |
path
The folder path. |
protected Flags |
permanentFlags
|
protected boolean |
subscribed
|
protected int |
type
The type of this folder(HOLDS_MESSAGES or HOLDS_FOLDERS). |
protected long |
uidValidity
|
Fields inherited from class javax.mail.Folder |
---|
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store |
Fields inherited from interface javax.mail.UIDFolder |
---|
LASTUID |
Constructor Summary | |
---|---|
protected |
IMAPFolder(Store store,
java.lang.String path)
Constructor. |
protected |
IMAPFolder(Store store,
java.lang.String path,
char delimiter)
Constructor. |
protected |
IMAPFolder(Store store,
java.lang.String path,
int type,
char delimiter)
Constructor. |
Method Summary | |
---|---|
void |
appendMessages(Message[] messages)
Appends the specified set of messages to this folder. |
void |
close(boolean expunge)
Closes this folder. |
boolean |
create(int type)
Create this folder. |
boolean |
delete(boolean flag)
Delete this folder. |
boolean |
equals(java.lang.Object other)
|
boolean |
exists()
Indicates whether this folder exists. |
Message[] |
expunge()
Expunges this folder. |
void |
fetch(Message[] messages,
FetchProfile fp)
IMAP fetch routine. |
int |
getDeletedMessageCount()
Returns the number of deleted messages in this folder. |
Folder |
getFolder(java.lang.String name)
Returns a subfolder with the specified name. |
java.lang.String |
getFullName()
Returns the full path of this folder. |
Message |
getMessage(int msgnum)
Returns the specified message number from this folder. |
Message |
getMessageByUID(long uid)
Returns the message corresponding to the given UID, or null if no such message exists. |
int |
getMessageCount()
Returns the number of messages in this folder. |
int |
getMessageCountByCriteria(java.lang.String criteria)
Convenience method for returning the number of messages in the current folder that match the single criteria. |
Message[] |
getMessagesByUID(long[] uids)
Returns the messages specified by the given UIDs. |
Message[] |
getMessagesByUID(long start,
long end)
Returns the messages in the given range. |
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 of this folder. |
Flags |
getPermanentFlags()
Returns the permanent flags for this folder. |
Quota[] |
getQuota()
Returns the quotas for this folder. |
char |
getSeparator()
Returns the path separator charcter. |
int |
getType()
Returns the type of this folder. |
long |
getUID(Message message)
Returns the UID for the specified message. |
long |
getUIDValidity()
Returns the UIDValidity value associated with this folder. |
int |
getUnreadMessageCount()
Returns the number of unread messages in this folder. |
boolean |
hasNewMessages()
Indicates whether this folder contains new messages. |
boolean |
isOpen()
Indicates whether this folder is open. |
boolean |
isSubscribed()
Indicates whether this folder is subscribed. |
Folder[] |
list(java.lang.String pattern)
Returns the subfolders for this folder. |
Folder[] |
listSubscribed(java.lang.String pattern)
Returns the subscribed subfolders for this folder. |
void |
open(int mode)
Opens this folder. |
boolean |
renameTo(Folder folder)
Rename this folder. |
Message[] |
search(SearchTerm term)
IMAP search function. |
Message[] |
search(SearchTerm term,
Message[] msgs)
IMAP search function. |
void |
setSubscribed(boolean flag)
Subscribe to or unsubscribe from this folder. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String path
protected int type
protected Flags permanentFlags
protected char delimiter
protected int messageCount
protected int newMessageCount
protected long uidValidity
protected boolean subscribed
Constructor Detail |
---|
protected IMAPFolder(Store store, java.lang.String path)
protected IMAPFolder(Store store, java.lang.String path, char delimiter)
protected IMAPFolder(Store store, java.lang.String path, int type, char delimiter)
Method Detail |
---|
public java.lang.String getName()
getName
in class Folder
public java.lang.String getFullName()
getFullName
in class Folder
public int getType() throws MessagingException
getType
in class Folder
MessagingException
- if a messaging error occurredpublic boolean exists() throws MessagingException
exists
in class Folder
MessagingException
- if a messaging error occurredpublic boolean hasNewMessages() throws MessagingException
hasNewMessages
in class Folder
MessagingException
- if a messaging error occurredpublic void open(int mode) throws MessagingException
open
in class Folder
mode
- open the Folder READ_ONLY or READ_WRITE
MessagingException
- if a messaging error occurredpublic boolean create(int type) throws MessagingException
create
in class Folder
type
- the desired type of the folder
MessagingException
public boolean delete(boolean flag) throws MessagingException
delete
in class Folder
flag
- delete any subfolders
FolderNotFoundException
- if this folder does not exist
MessagingException
public boolean renameTo(Folder folder) throws MessagingException
renameTo
in class Folder
folder
- a folder representing the new name for this folder
FolderNotFoundException
- if this folder does not exist
MessagingException
public void close(boolean expunge) throws MessagingException
close
in class Folder
expunge
- if the folder is to be expunged before it is closed
MessagingException
- if a messaging error occurredpublic Message[] expunge() throws MessagingException
expunge
in class Folder
MessagingException
- if a messaging error occurredpublic boolean isOpen()
isOpen
in class Folder
public Flags getPermanentFlags()
getPermanentFlags
in class Folder
public int getMessageCount() throws MessagingException
getMessageCount
in class Folder
MessagingException
- if a messaging error occurredpublic int getNewMessageCount() throws MessagingException
getNewMessageCount
in class Folder
MessagingException
- if a messaging error occurredpublic Message getMessage(int msgnum) throws MessagingException
getMessage
in class Folder
msgnum
- the message number
MessagingException
- if a messaging error occurredpublic void appendMessages(Message[] messages) throws MessagingException
MimeMessage
s are accepted.
appendMessages
in class Folder
messages
- array of messages to be appended
FolderNotFoundException
- if this folder does not exist
MessagingException
- if the append operation failedpublic void fetch(Message[] messages, FetchProfile fp) throws MessagingException
fetch
in class Folder
messages
- the messages to fetch the items forfp
- the fetch profile
MessagingException
public Message[] search(SearchTerm term) throws MessagingException
search
in class Folder
term
- the search term
FolderNotFoundException
- if this folder does not exist
MessagingException
public Message[] search(SearchTerm term, Message[] msgs) throws MessagingException
search
in class Folder
term
- the search termmsgs
- the messages to be searched
MessagingException
public boolean isSubscribed()
Folder
This method can be invoked on a closed folder.
isSubscribed
in class Folder
public void setSubscribed(boolean flag) throws MessagingException
Folder
This method can be invoked on a closed folder.
setSubscribed
in class Folder
MessagingException
public Folder[] list(java.lang.String pattern) throws MessagingException
list
in class Folder
pattern
- the match pattern
MessagingException
public Folder[] listSubscribed(java.lang.String pattern) throws MessagingException
listSubscribed
in class Folder
pattern
- the match pattern
MessagingException
public Folder getParent() throws MessagingException
getParent
in class Folder
MessagingException
public Folder getFolder(java.lang.String name) throws MessagingException
getFolder
in class Folder
name
- the name of the folder
MessagingException
public char getSeparator() throws MessagingException
getSeparator
in class Folder
MessagingException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public long getUIDValidity() throws MessagingException
UIDFolder
A client should compare this value against a UIDValidity value saved from a previous session to ensure that any cached UIDs are valid.
getUIDValidity
in interface UIDFolder
MessagingException
public Message getMessageByUID(long uid) throws MessagingException
UIDFolder
null
if no such message exists.
getMessageByUID
in interface UIDFolder
uid
- the UID of the desired message
MessagingException
public Message[] getMessagesByUID(long start, long end) throws MessagingException
UIDFolder
end
parameter
to indicate the last available UID.
getMessagesByUID
in interface UIDFolder
start
- the start UIDend
- the end UID
MessagingException
public Message[] getMessagesByUID(long[] uids) throws MessagingException
UIDFolder
null
is returned for that entry.
The returned array will be of the same size as the specified UIDs.
getMessagesByUID
in interface UIDFolder
uids
- the UIDs
MessagingException
public long getUID(Message message) throws MessagingException
UIDFolder
getUID
in interface UIDFolder
message
- a message in this folder
MessagingException
public Quota[] getQuota() throws MessagingException
MessagingException
public int getUnreadMessageCount() throws MessagingException
getUnreadMessageCount
in class Folder
MessagingException
Folder.getUnreadMessageCount()
public int getDeletedMessageCount() throws MessagingException
getDeletedMessageCount
in class Folder
FolderNotFoundException
- if this folder does not exist
MessagingException
Folder.getDeletedMessageCount()
public int getMessageCountByCriteria(java.lang.String criteria) throws MessagingException
MessagingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |