Package com.sun.mail.pop3
Class POP3Folder
java.lang.Object
jakarta.mail.Folder
com.sun.mail.pop3.POP3Folder
- All Implemented Interfaces:
AutoCloseable
A POP3 Folder (can only be "INBOX").
See the com.sun.mail.pop3 package
documentation for further information on the POP3 protocol provider.
- Author:
- Bill Shannon, John Mani (ported to the jakarta.mail APIs)
-
Field Summary
Fields inherited from class jakarta.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendMessages(Message[] msgs) Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support appending messages.voidclose(boolean expunge) booleancreate(int type) Always returnsfalse; the POP3 protocol doesn't support creating folders.protected POP3MessagecreateMessage(Folder f, int msgno) booleandelete(boolean recurse) Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't allow the INBOX to be deleted.booleanexists()Always true for the folder "INBOX", always false for any other name.Message[]expunge()Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support expunging messages without closing the folder; call theclosemethod with theexpungeargument set totrueinstead.voidfetch(Message[] msgs, FetchProfile fp) Prefetch information about POP3 messages.protected voidfinalize()Close the folder when we're finalized.Always throwsMessagingExceptionbecause no POP3 folders can contain subfolders.getMessage(int msgno) intWill not change while the folder is open because the POP3 protocol doesn't support notification of new messages arriving in open folders.getName()Always returns an emptyFlagsobject because the POP3 protocol doesn't support any permanent flags.charAlways returns a NUL character because POP3 doesn't support a hierarchy.intgetSize()Return the size of this folder, as was returned by the POP3 STAT command when this folder was opened.int[]getSizes()Return the sizes of all messages in this folder, as returned by the POP3 LIST command.intgetType()Always returns Folder.HOLDS_MESSAGES.Return the unique ID string for this message, or null if not available.booleanAlways returnsfalse; the POP3 protocol provides no way to determine when a new message arrives.booleanisOpen()Folder[]Always throwsMessagingExceptionbecause no POP3 folders can contain subfolders.Return the raw results of the POP3 LIST command with no arguments.protected voidnotifyMessageChangedListeners(int type, Message m) voidopen(int mode) ThrowsFolderNotFoundExceptionunless this folder is named "INBOX".booleanAlways throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support multiple folders.Methods inherited from class jakarta.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, close, copyMessages, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, isSubscribed, list, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
-
Constructor Details
-
POP3Folder
-
-
Method Details
-
getName
-
getFullName
- Specified by:
getFullNamein classFolder
-
getParent
-
exists
public boolean exists()Always true for the folder "INBOX", always false for any other name. -
list
Always throwsMessagingExceptionbecause no POP3 folders can contain subfolders.- Specified by:
listin classFolder- Throws:
MessagingException- always
-
getSeparator
public char getSeparator()Always returns a NUL character because POP3 doesn't support a hierarchy.- Specified by:
getSeparatorin classFolder- Returns:
- NUL
-
getType
public int getType()Always returns Folder.HOLDS_MESSAGES. -
create
Always returnsfalse; the POP3 protocol doesn't support creating folders.- Specified by:
createin classFolder- Returns:
- false
- Throws:
MessagingException
-
hasNewMessages
Always returnsfalse; the POP3 protocol provides no way to determine when a new message arrives.- Specified by:
hasNewMessagesin classFolder- Returns:
- false
- Throws:
MessagingException
-
getFolder
Always throwsMessagingExceptionbecause no POP3 folders can contain subfolders.- Specified by:
getFolderin classFolder- Throws:
MessagingException- always
-
delete
Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't allow the INBOX to be deleted.- Specified by:
deletein classFolder- Throws:
MethodNotSupportedException- alwaysMessagingException
-
renameTo
Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support multiple folders.- Specified by:
renameToin classFolder- Throws:
MethodNotSupportedException- alwaysMessagingException
-
open
ThrowsFolderNotFoundExceptionunless this folder is named "INBOX".- Specified by:
openin classFolder- Throws:
FolderNotFoundException- if not INBOXAuthenticationFailedException- authentication failuresMessagingException- other open failures
-
close
- Specified by:
closein classFolder- Throws:
MessagingException
-
isOpen
public boolean isOpen() -
getPermanentFlags
Always returns an emptyFlagsobject because the POP3 protocol doesn't support any permanent flags.- Specified by:
getPermanentFlagsin classFolder- Returns:
- empty Flags object
-
getMessageCount
Will not change while the folder is open because the POP3 protocol doesn't support notification of new messages arriving in open folders.- Specified by:
getMessageCountin classFolder- Throws:
MessagingException
-
getMessage
- Specified by:
getMessagein classFolder- Throws:
MessagingException
-
createMessage
- Throws:
MessagingException
-
appendMessages
Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support appending messages.- Specified by:
appendMessagesin classFolder- Throws:
MethodNotSupportedException- alwaysMessagingException
-
expunge
Always throwsMethodNotSupportedExceptionbecause the POP3 protocol doesn't support expunging messages without closing the folder; call theclosemethod with theexpungeargument set totrueinstead.- Specified by:
expungein classFolder- Throws:
MethodNotSupportedException- alwaysMessagingException
-
fetch
Prefetch information about POP3 messages. If the FetchProfile containsUIDFolder.FetchProfileItem.UID, POP3 UIDs for all messages in the folder are fetched using the POP3 UIDL command. If the FetchProfile containsFetchProfile.Item.ENVELOPE, the headers and size of all messages are fetched using the POP3 TOP and LIST commands.- Overrides:
fetchin classFolder- Throws:
MessagingException
-
getUID
Return the unique ID string for this message, or null if not available. Uses the POP3 UIDL command.- Parameters:
msg- the message- Returns:
- unique ID string
- Throws:
MessagingException- for failures
-
getSize
Return the size of this folder, as was returned by the POP3 STAT command when this folder was opened.- Returns:
- folder size
- Throws:
IllegalStateException- if the folder isn't openMessagingException- for other failures
-
getSizes
Return the sizes of all messages in this folder, as returned by the POP3 LIST command. Each entry in the array corresponds to a message; entry i corresponds to message number i+1.- Returns:
- array of message sizes
- Throws:
IllegalStateException- if the folder isn't openMessagingException- for other failures- Since:
- JavaMail 1.3.3
-
listCommand
Return the raw results of the POP3 LIST command with no arguments.- Returns:
- InputStream containing results
- Throws:
IllegalStateException- if the folder isn't openIOException- for I/O errors talking to the serverMessagingException- for other errors- Since:
- JavaMail 1.3.3
-
finalize
Close the folder when we're finalized. -
notifyMessageChangedListeners
- Overrides:
notifyMessageChangedListenersin classFolder
-