Class NNTPRootFolder
- java.lang.Object
-
- javax.mail.Folder
-
- gnu.mail.providers.nntp.NNTPRootFolder
-
public final class NNTPRootFolder extends Folder
The "root" folder of the NNTP newsgroup list. The NNTP folder namespace is taken to be a flat namespace. This object allows us to retrieve folders corresponding to each newsgroup in that space.- Version:
- 2.0
- Author:
- Chris Burdess, Cedric Hyppolite
-
-
Field Summary
-
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendMessages(Message[] messages)Appends the specified messages to this folder.voidclose(boolean expunge)Closes this folder.booleancreate(int type)Create this folder in the store.booleandelete(boolean flag)Deletes this folder.booleanexists()Indicates whether this folder exists in the Store.Message[]expunge()Expunges (permanently removing) all the messages marked DELETED.FoldergetFolder(java.lang.String name)Returns a new Folder object associated with the specified name.java.lang.StringgetFullName()Returns the full name of this folder.MessagegetMessage(int msgnum)Returns the message with the given number.intgetMessageCount()Returns the number of messages in this folder.java.lang.StringgetName()Returns the name of this folder.FoldergetParent()Returns the parent folder of this folder, ornullif this folder is the root of a folder hierarchy.FlagsgetPermanentFlags()Returns the permanent flags supported by this folder.chargetSeparator()As we're dealing with a flat namespace, the value of this is irrelevant.intgetType()This folder contains only folders.booleanhasNewMessages()Indicates whether this folder has new messages.booleanisOpen()Indicates whether this folder is open.Folder[]list(ListFolderListener listener)Returns the list of folders matching the specified pattern.Folder[]list(java.lang.String pattern)Returns the list of folders matching the specified pattern.Folder[]list(java.lang.String pattern, ListFolderListener listener)Returns the list of folders matching the specified pattern.Folder[]listSubscribed(java.lang.String pattern)Returns the list of subscribed folders matching the specified pattern.voidopen(int mode)Opens this folder.booleanrenameTo(Folder folder)Renames this folder.voidsetSubscribed(boolean flag)This folder is always "subscribed".-
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, isSubscribed, list, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, toString
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:FolderReturns the name of this folder.This method can be invoked on a closed folder.
-
getFullName
public java.lang.String getFullName()
Description copied from class:FolderReturns the full name of this folder. If the folder resides under the root hierarchy of its store, the returned name is relative to the root. Otherwise an absolute name, starting with the hierarchy delimiter, is returned.This method can be invoked on a closed folder.
- Specified by:
getFullNamein classFolder
-
list
public Folder[] list(java.lang.String pattern) throws MessagingException
Returns the list of folders matching the specified pattern.- Specified by:
listin classFolder- Parameters:
pattern- the JavaMail pattern- Throws:
MessagingException
-
list
public Folder[] list(ListFolderListener listener) throws MessagingException
Returns the list of folders matching the specified pattern.- Parameters:
listener- the listener to be called as soon as a new folder is listed- Throws:
MessagingException
-
list
public Folder[] list(java.lang.String pattern, ListFolderListener listener) throws MessagingException
Returns the list of folders matching the specified pattern.- Parameters:
pattern- the JavaMail patternlistener- the listener that will be called for each folder name as soon as it is known- Throws:
MessagingException
-
listSubscribed
public Folder[] listSubscribed(java.lang.String pattern) throws MessagingException
Returns the list of subscribed folders matching the specified pattern.- Overrides:
listSubscribedin classFolder- Parameters:
pattern- the JavaMail pattern- Throws:
MessagingException
-
getFolder
public Folder getFolder(java.lang.String name) throws MessagingException
Returns a new Folder object associated with the specified name.- Specified by:
getFolderin classFolder- Parameters:
name- the name of the folder- Throws:
MessagingException
-
getParent
public Folder getParent() throws MessagingException
Description copied from class:FolderReturns the parent folder of this folder, ornullif this folder is the root of a folder hierarchy.This method can be invoked on a closed folder.
- Specified by:
getParentin classFolder- Throws:
MessagingException
-
exists
public boolean exists() throws MessagingExceptionDescription copied from class:FolderIndicates whether this folder exists in the Store.This method can be invoked on a closed folder.
- Specified by:
existsin classFolder- Throws:
MessagingException
-
getSeparator
public char getSeparator() throws MessagingExceptionAs we're dealing with a flat namespace, the value of this is irrelevant.- Specified by:
getSeparatorin classFolder- Throws:
MessagingException
-
getType
public int getType()
This folder contains only folders.
-
open
public void open(int mode) throws MessagingExceptionDescription copied from class:FolderOpens this folder. This method can only be invoked on a closed folder that can contain messages.- Specified by:
openin classFolder- Parameters:
mode- open the Folder READ_ONLY or READ_WRITE- Throws:
FolderNotFoundException- if this folder does not existMessagingException
-
close
public void close(boolean expunge) throws MessagingExceptionDescription copied from class:FolderCloses this folder. This method can only be invoked on an open folder.- Specified by:
closein classFolder- Parameters:
expunge- if true, expunge all deleted messages- Throws:
MessagingException
-
expunge
public Message[] expunge() throws MessagingException
Description copied from class:FolderExpunges (permanently removing) all the messages marked DELETED. Returns an array containing the expunged messages.Expunge causes the renumbering of any messages with numbers higher than the message number of the lowest-numbered expunged message.
After a message has been expunged, only the
isExpungedandgetMessageNumbermethods are still valid on the corresponding Message object; other methods may throwMessageRemovedException.- Specified by:
expungein classFolder- Throws:
FolderNotFoundException- if this folder does not existMessagingException
-
isOpen
public boolean isOpen()
Description copied from class:FolderIndicates whether this folder is open.
-
getPermanentFlags
public Flags getPermanentFlags()
Description copied from class:FolderReturns the permanent flags supported by this folder.- Specified by:
getPermanentFlagsin classFolder
-
getMessageCount
public int getMessageCount() throws MessagingExceptionDescription copied from class:FolderReturns the number of messages in this folder.This method can be invoked on a closed folder; however, note that for some stores, getting the message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose to return -1 here when the folder is closed.
- Specified by:
getMessageCountin classFolder- Throws:
MessagingException
-
getMessage
public Message getMessage(int msgnum) throws MessagingException
Description copied from class:FolderReturns the message with the given number. The message number is the relative position of a message in its folder, starting at 1.Note that message numbers can change within a session if the folder is expunged, therefore the use of message numbers as references to messages is inadvisable.
- Specified by:
getMessagein classFolder- Parameters:
msgnum- the message number- Throws:
FolderNotFoundException- if this folder does not existMessagingException
-
setSubscribed
public void setSubscribed(boolean flag) throws MessagingExceptionThis folder is always "subscribed".- Overrides:
setSubscribedin classFolder- Throws:
MessagingException
-
hasNewMessages
public boolean hasNewMessages() throws MessagingExceptionDescription copied from class:FolderIndicates whether this folder has new messages.This method can be invoked on a closed folder that can contain messages.
- Specified by:
hasNewMessagesin classFolder- Throws:
MessagingException
-
appendMessages
public void appendMessages(Message[] messages) throws MessagingException
Description copied from class:FolderAppends the specified messages to this folder.This method can be invoked on a closed 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
-
create
public boolean create(int type) throws MessagingExceptionDescription copied from class:FolderCreate this folder in the store. When this folder is created, any folders in its path that do not exist are also created.If the creation is successful, a CREATED FolderEvent is delivered to any FolderListeners registered on this Folder and this Store.
- Specified by:
createin classFolder- Parameters:
type- the desired type of the folder- Throws:
MessagingException
-
delete
public boolean delete(boolean flag) throws MessagingExceptionDescription copied from class:FolderDeletes this folder. This method can only be invoked on a closed folder.- 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
Description copied from class:FolderRenames this folder. This method can only be invoked on a closed folder.- 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
-
-