Class JcrFolder

    • Constructor Detail

      • JcrFolder

        public JcrFolder()
    • Method Detail

      • appendMessages

        public void appendMessages​(javax.mail.Message[] messages)
                            throws javax.mail.MessagingException
        Append the specified messages to this delegate.
        Specified by:
        appendMessages in interface FolderDelegate<JcrMessage>
        Parameters:
        messages - an array of messages to append to the folder
        Throws:
        javax.mail.MessagingException - where an error occurs appending the messages
      • create

        public boolean create​(int type)
                       throws javax.mail.MessagingException
        Initialise the delegate based on the specified folder type.
        Specified by:
        create in interface FolderDelegate<JcrMessage>
        Parameters:
        type - a folder type
        Returns:
        true if the delegate is created, otherwise false
        Throws:
        javax.mail.MessagingException - where an unexpected error occurs creating the delegate
      • delete

        public boolean delete()
        Delete the folder delegate.
        Specified by:
        delete in interface FolderDelegate<JcrMessage>
        Returns:
        true if the delegate is deleted, otherwise false
      • exists

        public boolean exists()
        Indicates whether the folder represented by this delegate exists.
        Specified by:
        exists in interface FolderDelegate<JcrMessage>
        Returns:
        true if the folder exists, otherwise false
      • expunge

        public void expunge​(javax.mail.Message[] deleted)
        Permanently delete the specified messages from this delegate.
        Specified by:
        expunge in interface FolderDelegate<JcrMessage>
        Parameters:
        deleted - an array of deleted messages to expunge
      • getFolder

        public FolderDelegate<JcrMessage> getFolder​(String name)
        Returns a child folder delegate with the specified name.
        Specified by:
        getFolder in interface FolderDelegate<JcrMessage>
        Parameters:
        name - a folder name
        Returns:
        the folder delegate with the specified name, or null if the folder doesn't exist
      • getMessage

        public JcrMessage getMessage​(int messageNumber)
        Returns message delegate corresponding to the specified message id. If no delegate exists a new Message delegate is created.
        Specified by:
        getMessage in interface FolderDelegate<JcrMessage>
        Parameters:
        messageNumber - the message number of the message to retrieve
        Returns:
        the message with the specified message number, or null if the messages doesn't exist
      • getMessageAsStream

        public InputStream getMessageAsStream​(int index)
        Returns an input stream from which to read the specified message.
        Specified by:
        getMessageAsStream in interface FolderDelegate<JcrMessage>
        Parameters:
        index - the index of the message to return
        Returns:
        an input stream for the specified message
      • getMessageCount

        public int getMessageCount()
        Returns the number of messages in the folder delegate.
        Specified by:
        getMessageCount in interface FolderDelegate<JcrMessage>
        Returns:
        the total message count
      • getType

        public int getType()
        Specified by:
        getType in interface FolderDelegate<JcrMessage>
        Returns:
        the type of folder this delegate represents.
        See Also:
        Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES
      • list

        public FolderDelegate<JcrMessage>[] list​(String pattern)
        Returns a list of child folder delegates matching the specified pattern.
        Specified by:
        list in interface FolderDelegate<JcrMessage>
        Parameters:
        pattern - a pattern to match folders against
        Returns:
        a list of folder delegates
      • open

        public void open​(int mode)
        Open the folder delegate.
        Specified by:
        open in interface FolderDelegate<JcrMessage>
        Parameters:
        mode - the mode to open the folder
        See Also:
        Folder.READ_ONLY, Folder.READ_WRITE
      • renameTo

        public boolean renameTo​(String name)
        Rename the folder delegate.
        Specified by:
        renameTo in interface FolderDelegate<JcrMessage>
        Parameters:
        name - the new folder name
        Returns:
        true if the folder is renamed, otherwise false