java.lang.AutoCloseable
public class POP3Folder
extends javax.mail.Folder
Modifier | Constructor | Description |
---|---|---|
protected |
POP3Folder(POP3Store store,
java.lang.String name) |
Modifier and Type | Method | Description |
---|---|---|
void |
appendMessages(javax.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(javax.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.
|
javax.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(javax.mail.Message[] msgs,
javax.mail.FetchProfile fp) |
Prefetch information about POP3 messages.
|
protected void |
finalize() |
Close the folder when we're finalized.
|
javax.mail.Folder |
getFolder(java.lang.String name) |
Always throws
MessagingException because no POP3 folders
can contain subfolders. |
java.lang.String |
getFullName() |
|
javax.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() |
|
javax.mail.Folder |
getParent() |
|
javax.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(javax.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() |
|
javax.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,
javax.mail.Message m) |
|
void |
open(int mode) |
Throws
FolderNotFoundException unless this
folder is named "INBOX". |
boolean |
renameTo(javax.mail.Folder f) |
Always throws
MethodNotSupportedException
because the POP3 protocol doesn't support multiple folders. |
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
protected POP3Folder(POP3Store store, java.lang.String name)
public java.lang.String getName()
getName
in class javax.mail.Folder
public java.lang.String getFullName()
getFullName
in class javax.mail.Folder
public javax.mail.Folder getParent()
getParent
in class javax.mail.Folder
public boolean exists()
exists
in class javax.mail.Folder
public javax.mail.Folder[] list(java.lang.String pattern) throws javax.mail.MessagingException
MessagingException
because no POP3 folders
can contain subfolders.list
in class javax.mail.Folder
javax.mail.MessagingException
- alwayspublic char getSeparator()
getSeparator
in class javax.mail.Folder
public int getType()
getType
in class javax.mail.Folder
public boolean create(int type) throws javax.mail.MessagingException
false
; the POP3 protocol doesn't
support creating folders.create
in class javax.mail.Folder
javax.mail.MessagingException
public boolean hasNewMessages() throws javax.mail.MessagingException
false
; the POP3 protocol provides
no way to determine when a new message arrives.hasNewMessages
in class javax.mail.Folder
javax.mail.MessagingException
public javax.mail.Folder getFolder(java.lang.String name) throws javax.mail.MessagingException
MessagingException
because no POP3 folders
can contain subfolders.getFolder
in class javax.mail.Folder
javax.mail.MessagingException
- alwayspublic boolean delete(boolean recurse) throws javax.mail.MessagingException
MethodNotSupportedException
because the POP3 protocol doesn't allow the INBOX to
be deleted.delete
in class javax.mail.Folder
javax.mail.MethodNotSupportedException
- alwaysjavax.mail.MessagingException
public boolean renameTo(javax.mail.Folder f) throws javax.mail.MessagingException
MethodNotSupportedException
because the POP3 protocol doesn't support multiple folders.renameTo
in class javax.mail.Folder
javax.mail.MethodNotSupportedException
- alwaysjavax.mail.MessagingException
public void open(int mode) throws javax.mail.MessagingException
FolderNotFoundException
unless this
folder is named "INBOX".open
in class javax.mail.Folder
javax.mail.FolderNotFoundException
- if not INBOXjavax.mail.AuthenticationFailedException
- authentication failuresjavax.mail.MessagingException
- other open failurespublic void close(boolean expunge) throws javax.mail.MessagingException
close
in class javax.mail.Folder
javax.mail.MessagingException
public boolean isOpen()
isOpen
in class javax.mail.Folder
public javax.mail.Flags getPermanentFlags()
Flags
object because
the POP3 protocol doesn't support any permanent flags.getPermanentFlags
in class javax.mail.Folder
public int getMessageCount() throws javax.mail.MessagingException
getMessageCount
in class javax.mail.Folder
javax.mail.MessagingException
public javax.mail.Message getMessage(int msgno) throws javax.mail.MessagingException
getMessage
in class javax.mail.Folder
javax.mail.MessagingException
protected POP3Message createMessage(javax.mail.Folder f, int msgno) throws javax.mail.MessagingException
javax.mail.MessagingException
public void appendMessages(javax.mail.Message[] msgs) throws javax.mail.MessagingException
MethodNotSupportedException
because the POP3 protocol doesn't support appending messages.appendMessages
in class javax.mail.Folder
javax.mail.MethodNotSupportedException
- alwaysjavax.mail.MessagingException
public javax.mail.Message[] expunge() throws javax.mail.MessagingException
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.expunge
in class javax.mail.Folder
javax.mail.MethodNotSupportedException
- alwaysjavax.mail.MessagingException
public void fetch(javax.mail.Message[] msgs, javax.mail.FetchProfile fp) throws javax.mail.MessagingException
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.fetch
in class javax.mail.Folder
javax.mail.MessagingException
public java.lang.String getUID(javax.mail.Message msg) throws javax.mail.MessagingException
msg
- the messagejavax.mail.MessagingException
- for failurespublic int getSize() throws javax.mail.MessagingException
java.lang.IllegalStateException
- if the folder isn't openjavax.mail.MessagingException
- for other failurespublic int[] getSizes() throws javax.mail.MessagingException
java.lang.IllegalStateException
- if the folder isn't openjavax.mail.MessagingException
- for other failurespublic java.io.InputStream listCommand() throws javax.mail.MessagingException, java.io.IOException
java.lang.IllegalStateException
- if the folder isn't openjava.io.IOException
- for I/O errors talking to the serverjavax.mail.MessagingException
- for other errorsprotected void finalize() throws java.lang.Throwable
finalize
in class javax.mail.Folder
java.lang.Throwable
protected void notifyMessageChangedListeners(int type, javax.mail.Message m)
notifyMessageChangedListeners
in class javax.mail.Folder