Package gnu.mail.providers.pop3
Class POP3Folder
- java.lang.Object
-
- javax.mail.Folder
-
- gnu.mail.providers.pop3.POP3Folder
-
public final class POP3Folder extends Folder
The folder class implementing the POP3 mail protocol.- Version:
- 1.3
- Author:
- Chris Burdess, Nic Ferrier
-
-
Field Summary
-
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPOP3Folder(Store store, int type)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendMessages(Message[] messages)You can't append messages to a POP3 folder.voidclose(boolean expunge)Closes this folder.booleancreate(int i)POP3 folders can't be created, deleted, or renamed.booleandelete(boolean flag)POP3 folders can't be created, deleted, or renamed.booleanexists()Indicates whether this folder exists.Message[]expunge()Expunges this folder.voidfetch(Message[] messages, FetchProfile fp)Fetches headers and/or content for the specified messages.FoldergetFolder(java.lang.String s)POP3 folders can't contain subfolders.java.lang.StringgetFullName()Returns the full name of this folder.MessagegetMessage(int msgnum)Returns the specified message from this folder.intgetMessageCount()Returns the number of messages in this folder.java.lang.StringgetName()Returns the name of this folder.FoldergetParent()POP3 folders can't have parents.FlagsgetPermanentFlags()Returns the permanent flags for this folder.chargetSeparator()Returns the path separator charcter.intgetType()Returns the type of this folder.java.lang.StringgetUID(Message message)Returns the unique ID for the given message, ornullif not available.booleanhasNewMessages()Indicates whether this folder contains new messages.booleanisOpen()Indicates whether this folder is open.Folder[]list()Returns the subfolders for this folder.Folder[]list(java.lang.String pattern)Returns the subfolders for this folder.voidopen(int mode)Opens this folder.booleanrenameTo(Folder folder)POP3 folders can't be created, deleted, or renamed.-
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, isSubscribed, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
-
-
-
-
Constructor Detail
-
POP3Folder
protected POP3Folder(Store store, int type)
Constructor.
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of this folder.
-
getFullName
public java.lang.String getFullName()
Returns the full name of this folder.- Specified by:
getFullNamein classFolder
-
getType
public int getType() throws MessagingExceptionReturns the type of this folder.- Specified by:
getTypein classFolder- Throws:
MessagingException- if a messaging error occurred
-
exists
public boolean exists() throws MessagingExceptionIndicates whether this folder exists.- Specified by:
existsin classFolder- Throws:
MessagingException- if a messaging error occurred
-
hasNewMessages
public boolean hasNewMessages() throws MessagingExceptionIndicates whether this folder contains new messages.- Specified by:
hasNewMessagesin classFolder- Throws:
MessagingException- if a messaging error occurred
-
open
public void open(int mode) throws MessagingExceptionOpens this folder.- Specified by:
openin classFolder- Parameters:
mode- open the Folder READ_ONLY or READ_WRITE- Throws:
MessagingException- if a messaging error occurred
-
close
public void close(boolean expunge) throws MessagingExceptionCloses this folder.- Specified by:
closein classFolder- 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:
expungein classFolder- Throws:
MessagingException- if a messaging error occurred
-
isOpen
public boolean isOpen()
Indicates whether this folder is open.
-
getPermanentFlags
public Flags getPermanentFlags()
Returns the permanent flags for this folder.- Specified by:
getPermanentFlagsin classFolder
-
getMessageCount
public int getMessageCount() throws MessagingExceptionReturns the number of messages in this folder. This results in a STAT call to the POP3 server, so the latest count is always delivered.- Specified by:
getMessageCountin classFolder- Throws:
MessagingException- if a messaging error occurred
-
getMessage
public Message getMessage(int msgnum) throws MessagingException
Returns the specified message from this folder.- Specified by:
getMessagein classFolder- Parameters:
msgnum- the message number- Throws:
MessagingException- if a messaging error occurred
-
appendMessages
public void appendMessages(Message[] messages) throws MessagingException
You can't append messages to a POP3 folder.- Specified by:
appendMessagesin classFolder- Parameters:
messages- array of messages to be appended- Throws:
FolderNotFoundException- if this folder does not existMessagingException- if the append operation failed
-
fetch
public void fetch(Message[] messages, FetchProfile fp) throws MessagingException
Fetches headers and/or content for the specified messages.- Overrides:
fetchin classFolder- Parameters:
messages- the messages to fetch the items forfp- the fetch profile- Throws:
MessagingException- ignore
-
list
public Folder[] list() throws MessagingException
Returns the subfolders for this folder.- Overrides:
listin classFolder- Throws:
MessagingException
-
list
public Folder[] list(java.lang.String pattern) throws MessagingException
Returns the subfolders for this folder.- Specified by:
listin classFolder- Parameters:
pattern- the match pattern- Throws:
MessagingException
-
getParent
public Folder getParent() throws MessagingException
POP3 folders can't have parents.- Specified by:
getParentin classFolder- Throws:
MessagingException
-
getFolder
public Folder getFolder(java.lang.String s) throws MessagingException
POP3 folders can't contain subfolders.- Specified by:
getFolderin classFolder- Parameters:
s- the name of the folder- Throws:
MessagingException
-
getSeparator
public char getSeparator() throws MessagingExceptionReturns the path separator charcter.- Specified by:
getSeparatorin classFolder- Throws:
MessagingException
-
create
public boolean create(int i) throws MessagingExceptionPOP3 folders can't be created, deleted, or renamed.- Specified by:
createin classFolder- Parameters:
i- the desired type of the folder- Throws:
MessagingException
-
delete
public boolean delete(boolean flag) throws MessagingExceptionPOP3 folders can't be created, deleted, or renamed.- Specified by:
deletein classFolder- Parameters:
flag- delete any subfolders- Returns:
- true if the folder is deleted successfully, false otherwise
- Throws:
FolderNotFoundException- if this folder does not existMessagingException
-
renameTo
public boolean renameTo(Folder folder) throws MessagingException
POP3 folders can't be created, deleted, or renamed.- Specified by:
renameToin classFolder- 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 existMessagingException
-
getUID
public java.lang.String getUID(Message message) throws MessagingException
Returns the unique ID for the given message, ornullif not available.- Parameters:
message- the message- Throws:
MessagingException
-
-