Class POP3Folder

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class POP3Folder
    extends jakarta.mail.Folder
    A POP3 Folder (can only be "INBOX"). See the org.eclipse.angus.mail.pop3 package documentation for further information on the POP3 protocol provider.

    • Field Summary

      • Fields inherited from class jakarta.mail.Folder

        HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected POP3Folder​(POP3Store store, java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendMessages​(jakarta.mail.Message[] msgs)
      Always throws MethodNotSupportedException because the POP3 protocol doesn't support appending messages.
      void close​(boolean expunge)  
      boolean create​(int type)
      Always returns false; the POP3 protocol doesn't support creating folders.
      protected POP3Message createMessage​(jakarta.mail.Folder f, int msgno)  
      boolean delete​(boolean recurse)
      Always throws MethodNotSupportedException because the POP3 protocol doesn't allow the INBOX to be deleted.
      boolean exists()
      Always true for the folder "INBOX", always false for any other name.
      jakarta.mail.Message[] expunge()
      Always throws MethodNotSupportedException because the POP3 protocol doesn't support expunging messages without closing the folder; call the close method with the expunge argument set to true instead.
      void fetch​(jakarta.mail.Message[] msgs, jakarta.mail.FetchProfile fp)
      Prefetch information about POP3 messages.
      protected void finalize()
      Close the folder when we're finalized.
      jakarta.mail.Folder getFolder​(java.lang.String name)
      Always throws MessagingException because no POP3 folders can contain subfolders.
      java.lang.String getFullName()  
      jakarta.mail.Message getMessage​(int msgno)  
      int getMessageCount()
      Will not change while the folder is open because the POP3 protocol doesn't support notification of new messages arriving in open folders.
      java.lang.String getName()  
      jakarta.mail.Folder getParent()  
      jakarta.mail.Flags getPermanentFlags()
      Always returns an empty Flags object because the POP3 protocol doesn't support any permanent flags.
      char getSeparator()
      Always returns a NUL character because POP3 doesn't support a hierarchy.
      int getSize()
      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.
      int getType()
      Always returns Folder.HOLDS_MESSAGES.
      java.lang.String getUID​(jakarta.mail.Message msg)
      Return the unique ID string for this message, or null if not available.
      boolean hasNewMessages()
      Always returns false; the POP3 protocol provides no way to determine when a new message arrives.
      boolean isOpen()  
      jakarta.mail.Folder[] list​(java.lang.String pattern)
      Always throws MessagingException because no POP3 folders can contain subfolders.
      java.io.InputStream listCommand()
      Return the raw results of the POP3 LIST command with no arguments.
      protected void notifyMessageChangedListeners​(int type, jakarta.mail.Message m)  
      void open​(int mode)
      Throws FolderNotFoundException unless this folder is named "INBOX".
      boolean renameTo​(jakarta.mail.Folder f)
      Always throws MethodNotSupportedException because 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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • POP3Folder

        protected POP3Folder​(POP3Store store,
                             java.lang.String name)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in class jakarta.mail.Folder
      • getFullName

        public java.lang.String getFullName()
        Specified by:
        getFullName in class jakarta.mail.Folder
      • getParent

        public jakarta.mail.Folder getParent()
        Specified by:
        getParent in class jakarta.mail.Folder
      • exists

        public boolean exists()
        Always true for the folder "INBOX", always false for any other name.
        Specified by:
        exists in class jakarta.mail.Folder
        Returns:
        true for INBOX, false otherwise
      • list

        public jakarta.mail.Folder[] list​(java.lang.String pattern)
                                   throws jakarta.mail.MessagingException
        Always throws MessagingException because no POP3 folders can contain subfolders.
        Specified by:
        list in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException - always
      • getSeparator

        public char getSeparator()
        Always returns a NUL character because POP3 doesn't support a hierarchy.
        Specified by:
        getSeparator in class jakarta.mail.Folder
        Returns:
        NUL
      • getType

        public int getType()
        Always returns Folder.HOLDS_MESSAGES.
        Specified by:
        getType in class jakarta.mail.Folder
        Returns:
        Folder.HOLDS_MESSAGES
      • create

        public boolean create​(int type)
                       throws jakarta.mail.MessagingException
        Always returns false; the POP3 protocol doesn't support creating folders.
        Specified by:
        create in class jakarta.mail.Folder
        Returns:
        false
        Throws:
        jakarta.mail.MessagingException
      • hasNewMessages

        public boolean hasNewMessages()
                               throws jakarta.mail.MessagingException
        Always returns false; the POP3 protocol provides no way to determine when a new message arrives.
        Specified by:
        hasNewMessages in class jakarta.mail.Folder
        Returns:
        false
        Throws:
        jakarta.mail.MessagingException
      • getFolder

        public jakarta.mail.Folder getFolder​(java.lang.String name)
                                      throws jakarta.mail.MessagingException
        Always throws MessagingException because no POP3 folders can contain subfolders.
        Specified by:
        getFolder in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException - always
      • delete

        public boolean delete​(boolean recurse)
                       throws jakarta.mail.MessagingException
        Always throws MethodNotSupportedException because the POP3 protocol doesn't allow the INBOX to be deleted.
        Specified by:
        delete in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MethodNotSupportedException - always
        jakarta.mail.MessagingException
      • renameTo

        public boolean renameTo​(jakarta.mail.Folder f)
                         throws jakarta.mail.MessagingException
        Always throws MethodNotSupportedException because the POP3 protocol doesn't support multiple folders.
        Specified by:
        renameTo in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MethodNotSupportedException - always
        jakarta.mail.MessagingException
      • open

        public void open​(int mode)
                  throws jakarta.mail.MessagingException
        Throws FolderNotFoundException unless this folder is named "INBOX".
        Specified by:
        open in class jakarta.mail.Folder
        Throws:
        jakarta.mail.FolderNotFoundException - if not INBOX
        jakarta.mail.AuthenticationFailedException - authentication failures
        jakarta.mail.MessagingException - other open failures
      • close

        public void close​(boolean expunge)
                   throws jakarta.mail.MessagingException
        Specified by:
        close in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in class jakarta.mail.Folder
      • getPermanentFlags

        public jakarta.mail.Flags getPermanentFlags()
        Always returns an empty Flags object because the POP3 protocol doesn't support any permanent flags.
        Specified by:
        getPermanentFlags in class jakarta.mail.Folder
        Returns:
        empty Flags object
      • getMessageCount

        public int getMessageCount()
                            throws jakarta.mail.MessagingException
        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:
        getMessageCount in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException
      • getMessage

        public jakarta.mail.Message getMessage​(int msgno)
                                        throws jakarta.mail.MessagingException
        Specified by:
        getMessage in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException
      • createMessage

        protected POP3Message createMessage​(jakarta.mail.Folder f,
                                            int msgno)
                                     throws jakarta.mail.MessagingException
        Throws:
        jakarta.mail.MessagingException
      • appendMessages

        public void appendMessages​(jakarta.mail.Message[] msgs)
                            throws jakarta.mail.MessagingException
        Always throws MethodNotSupportedException because the POP3 protocol doesn't support appending messages.
        Specified by:
        appendMessages in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MethodNotSupportedException - always
        jakarta.mail.MessagingException
      • expunge

        public jakarta.mail.Message[] expunge()
                                       throws jakarta.mail.MessagingException
        Always throws MethodNotSupportedException because the POP3 protocol doesn't support expunging messages without closing the folder; call the close method with the expunge argument set to true instead.
        Specified by:
        expunge in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MethodNotSupportedException - always
        jakarta.mail.MessagingException
      • fetch

        public void fetch​(jakarta.mail.Message[] msgs,
                          jakarta.mail.FetchProfile fp)
                   throws jakarta.mail.MessagingException
        Prefetch information about POP3 messages. If the FetchProfile contains UIDFolder.FetchProfileItem.UID, POP3 UIDs for all messages in the folder are fetched using the POP3 UIDL command. If the FetchProfile contains FetchProfile.Item.ENVELOPE, the headers and size of all messages are fetched using the POP3 TOP and LIST commands.
        Overrides:
        fetch in class jakarta.mail.Folder
        Throws:
        jakarta.mail.MessagingException
      • getUID

        public java.lang.String getUID​(jakarta.mail.Message msg)
                                throws jakarta.mail.MessagingException
        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:
        jakarta.mail.MessagingException - for failures
      • getSize

        public int getSize()
                    throws jakarta.mail.MessagingException
        Return the size of this folder, as was returned by the POP3 STAT command when this folder was opened.
        Returns:
        folder size
        Throws:
        java.lang.IllegalStateException - if the folder isn't open
        jakarta.mail.MessagingException - for other failures
      • getSizes

        public int[] getSizes()
                       throws jakarta.mail.MessagingException
        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:
        java.lang.IllegalStateException - if the folder isn't open
        jakarta.mail.MessagingException - for other failures
        Since:
        JavaMail 1.3.3
      • listCommand

        public java.io.InputStream listCommand()
                                        throws jakarta.mail.MessagingException,
                                               java.io.IOException
        Return the raw results of the POP3 LIST command with no arguments.
        Returns:
        InputStream containing results
        Throws:
        java.lang.IllegalStateException - if the folder isn't open
        java.io.IOException - for I/O errors talking to the server
        jakarta.mail.MessagingException - for other errors
        Since:
        JavaMail 1.3.3
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Close the folder when we're finalized.
        Overrides:
        finalize in class jakarta.mail.Folder
        Throws:
        java.lang.Throwable
      • notifyMessageChangedListeners

        protected void notifyMessageChangedListeners​(int type,
                                                     jakarta.mail.Message m)
        Overrides:
        notifyMessageChangedListeners in class jakarta.mail.Folder