gnu.mail.providers.nntp

Class NNTPFolder


public final class NNTPFolder
extends Folder

A JavaMail folder delegate for an NNTP newsgroup.

Field Summary

Fields inherited from class javax.mail.Folder

HOLDS_FOLDERS, HOLDS_MESSAGES, READ_ONLY, READ_WRITE, mode, store

Method Summary

void
appendMessages(Message[] messages)
NNTP servers are read-only.
void
close(boolean expunge)
This method has no particular meaning in NNTP.
boolean
create(int type)
NNTP servers are read-only.
boolean
delete(boolean recurse)
NNTP servers are read-only.
boolean
exists()
Indicates whether the newsgroup is present on the server.
Message[]
expunge()
NNTP servers are read-only.
void
fetch(Message[] msgs, FetchProfile fp)
Prefetch.
Folder
getFolder(String name)
This folder type does not contain other folders.
String
getFullName()
Message
getMessage(int msgnum)
Returns the article corresponding to the specified article number.
int
getMessageCount()
Returns the number of articles in this newsgroup.
Message[]
getMessages()
Returns all articles in this group.
int
getMode()
This folder type is always read-only.
String
getName()
Returns the name of the newsgroup, e.g.
Folder
getParent()
This implementation uses a flat namespace, so the parent of any NNTPFolder is the NNTP root folder.
Flags
getPermanentFlags()
Returns the flags supported by this folder.
char
getSeparator()
If we move away from a flat namespace, this might be useful.
int
getType()
Returns the type of this folder.
boolean
hasNewMessages()
Indicates whether there are new articles in this newsgroup.
boolean
isOpen()
boolean
isSubscribed()
Indicates if the newsgroup is subscribed.
Folder[]
list(String pattern)
This folder type does not contain other folders.
Folder[]
listSubscribed(String pattern)
This folder type does not contain other folders.
void
open(int mode)
This method has no particular meaning in NNTP.
boolean
renameTo(Folder folder)
NNTP servers are read-only.
void
setSubscribed(boolean flag)
Subscribes or unsubscribes to this newsgroup.

Methods inherited from class javax.mail.Folder

addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, appendMessages, close, copyMessages, create, delete, exists, expunge, fetch, getDeletedMessageCount, getFolder, getFullName, getMessage, getMessageCount, getMessages, getMessages, getMessages, getMode, getName, getNewMessageCount, getParent, getPermanentFlags, getSeparator, getStore, getType, getURLName, getUnreadMessageCount, hasNewMessages, isOpen, isSubscribed, list, list, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, open, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, renameTo, search, search, setFlags, setFlags, setFlags, setSubscribed, toString

Method Details

appendMessages

public void appendMessages(Message[] messages)
            throws MessagingException
NNTP servers are read-only.


close

public void close(boolean expunge)
            throws MessagingException
This method has no particular meaning in NNTP.
Overrides:
close in interface Folder


create

public boolean create(int type)
            throws MessagingException
NNTP servers are read-only.
Overrides:
create in interface Folder


delete

public boolean delete(boolean recurse)
            throws MessagingException
NNTP servers are read-only.
Overrides:
delete in interface Folder


exists

public boolean exists()
            throws MessagingException
Indicates whether the newsgroup is present on the server.
Overrides:
exists in interface Folder


expunge

public Message[] expunge()
            throws MessagingException
NNTP servers are read-only.
Overrides:
expunge in interface Folder


fetch

public void fetch(Message[] msgs,
                  FetchProfile fp)
            throws MessagingException
Prefetch.


getFolder

public Folder getFolder(String name)
            throws MessagingException
This folder type does not contain other folders.
Overrides:
getFolder in interface Folder


getFullName

public String getFullName()
Overrides:
getFullName in interface Folder

See Also:
getName()


getMessage

public Message getMessage(int msgnum)
            throws MessagingException
Returns the article corresponding to the specified article number.
Overrides:
getMessage in interface Folder


getMessageCount

public int getMessageCount()
            throws MessagingException
Returns the number of articles in this newsgroup.
Overrides:
getMessageCount in interface Folder


getMessages

public Message[] getMessages()
            throws MessagingException
Returns all articles in this group. This tries XHDR first to retrieve Message-IDs for the articles. If this fails we fall back to statting each article.
Overrides:
getMessages in interface Folder


getMode

public int getMode()
This folder type is always read-only.
Overrides:
getMode in interface Folder


getName

public String getName()
Returns the name of the newsgroup, e.g. alt.test.
Overrides:
getName in interface Folder


getParent

public Folder getParent()
            throws MessagingException
This implementation uses a flat namespace, so the parent of any NNTPFolder is the NNTP root folder.
Overrides:
getParent in interface Folder


getPermanentFlags

public Flags getPermanentFlags()
Returns the flags supported by this folder.
Overrides:
getPermanentFlags in interface Folder


getSeparator

public char getSeparator()
            throws MessagingException
If we move away from a flat namespace, this might be useful.
Overrides:
getSeparator in interface Folder


getType

public int getType()
            throws MessagingException
Returns the type of this folder. This folder type only holds messages.
Overrides:
getType in interface Folder


hasNewMessages

public boolean hasNewMessages()
            throws MessagingException
Indicates whether there are new articles in this newsgroup.
Overrides:
hasNewMessages in interface Folder


isOpen

public boolean isOpen()
Overrides:
isOpen in interface Folder


isSubscribed

public boolean isSubscribed()
Indicates if the newsgroup is subscribed. This uses the newsrc mechanism associated with this folder's store.
Overrides:
isSubscribed in interface Folder


list

public Folder[] list(String pattern)
            throws MessagingException
This folder type does not contain other folders.
Overrides:
list in interface Folder


listSubscribed

public Folder[] listSubscribed(String pattern)
            throws MessagingException
This folder type does not contain other folders.
Overrides:
listSubscribed in interface Folder


open

public void open(int mode)
            throws MessagingException
This method has no particular meaning in NNTP. However, we will use it to send a GROUP command and refresh our article stats.
Overrides:
open in interface Folder


renameTo

public boolean renameTo(Folder folder)
            throws MessagingException
NNTP servers are read-only.
Overrides:
renameTo in interface Folder


setSubscribed

public void setSubscribed(boolean flag)
            throws MessagingException
Subscribes or unsubscribes to this newsgroup. This uses the newsrc mechanism associated with this folder's store.
Overrides:
setSubscribed in interface Folder