com.sun.mail.pop3
类 POP3Folder

java.lang.Object
  继承者 javax.mail.Folder
      继承者 com.sun.mail.pop3.POP3Folder

public class POP3Folder
extends Folder

A POP3 Folder (can only be "INBOX"). See the com.sun.mail.pop3 package documentation for further information on the POP3 protocol provider.

作者:
Bill Shannon, John Mani (ported to the javax.mail APIs)

字段摘要
 
从类 javax.mail.Folder 继承的字段
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
方法摘要
 void appendMessages(Message[] msgs)
          Always throws MethodNotSupportedException because the POP3 protocol doesn't support appending messages.
 void close(boolean expunge)
          Close this Folder.
 boolean create(int type)
          Always returns false; the POP3 protocol doesn't support creating folders.
protected  POP3Message createMessage(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.
 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(Message[] msgs, FetchProfile fp)
          Prefetch information about POP3 messages.
protected  void finalize()
          Close the folder when we're finalized.
 Folder getFolder(String name)
          Always throws MessagingException because no POP3 folders can contain subfolders.
 String getFullName()
          Returns the full name of this Folder.
 Message getMessage(int msgno)
          Get the Message object corresponding to the given message number.
 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.
 String getName()
          Returns the name of this Folder.
 Folder getParent()
          Returns the parent folder of this folder.
 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.
 String getUID(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()
          Indicates whether this Folder is in the 'open' state.
 Folder[] list(String pattern)
          Always throws MessagingException because no POP3 folders can contain subfolders.
 InputStream listCommand()
          Return the raw results of the POP3 LIST command with no arguments.
protected  void notifyMessageChangedListeners(int type, Message m)
          Notify all MessageChangedListeners.
 void open(int mode)
          Throws FolderNotFoundException unless this folder is named "INBOX".
 boolean renameTo(Folder f)
          Always throws MethodNotSupportedException because the POP3 protocol doesn't support multiple folders.
 
从类 javax.mail.Folder 继承的方法
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, 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
 
从类 java.lang.Object 继承的方法
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

方法详细信息

getName

public String getName()
从类 Folder 复制的描述
Returns the name of this Folder.

This method can be invoked on a closed Folder.

指定者:
Folder 中的 getName
返回:
name of the Folder

getFullName

public String getFullName()
从类 Folder 复制的描述
Returns the full name of this Folder. If the folder resides under the root hierarchy of this 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.

指定者:
Folder 中的 getFullName
返回:
full name of the Folder

getParent

public Folder getParent()
从类 Folder 复制的描述
Returns the parent folder of this folder. This method can be invoked on a closed Folder. If this folder is the top of a folder hierarchy, this method returns null.

Note that since Folder objects are not cached, invoking this method returns a new distinct Folder object.

指定者:
Folder 中的 getParent
返回:
Parent folder

exists

public boolean exists()
Always true for the folder "INBOX", always false for any other name.

指定者:
Folder 中的 exists
返回:
true for INBOX, false otherwise
另请参见:
Folder.create(int)

list

public Folder[] list(String pattern)
              throws MessagingException
Always throws MessagingException because no POP3 folders can contain subfolders.

指定者:
Folder 中的 list
参数:
pattern - the match pattern
返回:
array of matching Folder objects. An empty array is returned if no matching Folders exist.
抛出:
MessagingException - always
另请参见:
Folder.listSubscribed(java.lang.String)

getSeparator

public char getSeparator()
Always returns a NUL character because POP3 doesn't support a hierarchy.

指定者:
Folder 中的 getSeparator
返回:
NUL

getType

public int getType()
Always returns Folder.HOLDS_MESSAGES.

指定者:
Folder 中的 getType
返回:
Folder.HOLDS_MESSAGES
另请参见:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES

create

public boolean create(int type)
               throws MessagingException
Always returns false; the POP3 protocol doesn't support creating folders.

指定者:
Folder 中的 create
参数:
type - The type of this folder.
返回:
false
抛出:
MessagingException
另请参见:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES, FolderEvent

hasNewMessages

public boolean hasNewMessages()
                       throws MessagingException
Always returns false; the POP3 protocol provides no way to determine when a new message arrives.

指定者:
Folder 中的 hasNewMessages
返回:
false
抛出:
FolderNotFoundException - if this folder does not exist.
MessagingException

getFolder

public Folder getFolder(String name)
                 throws MessagingException
Always throws MessagingException because no POP3 folders can contain subfolders.

指定者:
Folder 中的 getFolder
参数:
name - name of the Folder
返回:
Folder object
抛出:
MessagingException - always

delete

public boolean delete(boolean recurse)
               throws MessagingException
Always throws MethodNotSupportedException because the POP3 protocol doesn't allow the INBOX to be deleted.

指定者:
Folder 中的 delete
返回:
true if the Folder is deleted successfully
抛出:
MethodNotSupportedException - always
FolderNotFoundException - if this folder does not exist
MessagingException
另请参见:
FolderEvent

renameTo

public boolean renameTo(Folder f)
                 throws MessagingException
Always throws MethodNotSupportedException because the POP3 protocol doesn't support multiple folders.

指定者:
Folder 中的 renameTo
参数:
f - a folder representing the new name for this Folder
返回:
true if the Folder is renamed successfully
抛出:
MethodNotSupportedException - always
FolderNotFoundException - if this folder does not exist
MessagingException
另请参见:
FolderEvent

open

public void open(int mode)
          throws MessagingException
Throws FolderNotFoundException unless this folder is named "INBOX".

指定者:
Folder 中的 open
参数:
mode - open the Folder READ_ONLY or READ_WRITE
抛出:
FolderNotFoundException - if not INBOX
AuthenticationException - authentication failures
MessagingException - other open failures
另请参见:
Folder.READ_ONLY, Folder.READ_WRITE, Folder.getType(), ConnectionEvent

close

public void close(boolean expunge)
           throws MessagingException
从类 Folder 复制的描述
Close this Folder. This method is valid only on open Folders.

A CLOSED ConnectionEvent is delivered to any ConnectionListeners registered on this Folder. Note that the folder is closed even if this method terminates abnormally by throwing a MessagingException.

指定者:
Folder 中的 close
参数:
expunge - expunges all deleted messages if this flag is true
抛出:
MessagingException
另请参见:
ConnectionEvent

isOpen

public boolean isOpen()
从类 Folder 复制的描述
Indicates whether this Folder is in the 'open' state.

指定者:
Folder 中的 isOpen
返回:
true if this Folder is in the 'open' state.

getPermanentFlags

public Flags getPermanentFlags()
Always returns an empty Flags object because the POP3 protocol doesn't support any permanent flags.

指定者:
Folder 中的 getPermanentFlags
返回:
empty Flags object

getMessageCount

public int getMessageCount()
                    throws MessagingException
Will not change while the folder is open because the POP3 protocol doesn't support notification of new messages arriving in open folders.

指定者:
Folder 中的 getMessageCount
返回:
total number of messages. -1 may be returned by certain implementations if this method is invoked on a closed folder.
抛出:
FolderNotFoundException - if this folder does not exist.
MessagingException

getMessage

public Message getMessage(int msgno)
                   throws MessagingException
从类 Folder 复制的描述
Get the Message object corresponding to the given message number. A Message object's message number is the relative position of this Message in its Folder. Messages are numbered starting at 1 through the total number of message in the folder. Note that the message number for a particular Message can change during a session if other messages in the Folder are deleted and the Folder is expunged.

Message objects are light-weight references to the actual message that get filled up on demand. Hence Folder implementations are expected to provide light-weight Message objects.

Unlike Folder objects, repeated calls to getMessage with the same message number will return the same Message object, as long as no messages in this folder have been expunged.

Since message numbers can change within a session if the folder is expunged , clients are advised not to use message numbers as references to messages. Use Message objects instead.

指定者:
Folder 中的 getMessage
参数:
msgno - the message number
返回:
the Message object
抛出:
FolderNotFoundException - if this folder does not exist.
MessagingException
另请参见:
Folder.getMessageCount(), Folder.fetch(javax.mail.Message[], javax.mail.FetchProfile)

createMessage

protected POP3Message createMessage(Folder f,
                                    int msgno)
                             throws MessagingException
抛出:
MessagingException

appendMessages

public void appendMessages(Message[] msgs)
                    throws MessagingException
Always throws MethodNotSupportedException because the POP3 protocol doesn't support appending messages.

指定者:
Folder 中的 appendMessages
参数:
msgs - array of Messages to be appended
抛出:
MethodNotSupportedException - always
FolderNotFoundException - if this folder does not exist.
MessagingException - if the append failed.

expunge

public Message[] expunge()
                  throws 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.

指定者:
Folder 中的 expunge
返回:
array of expunged Message objects
抛出:
MethodNotSupportedException - always
FolderNotFoundException - if this folder does not exist
MessagingException
另请参见:
Message.isExpunged(), MessageCountEvent

fetch

public void fetch(Message[] msgs,
                  FetchProfile fp)
           throws 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.

覆盖:
Folder 中的 fetch
参数:
msgs - fetch items for these messages
fp - the FetchProfile
抛出:
MessagingException

getUID

public String getUID(Message msg)
              throws MessagingException
Return the unique ID string for this message, or null if not available. Uses the POP3 UIDL command.

返回:
unique ID string
抛出:
MessagingException

getSize

public int getSize()
            throws MessagingException
Return the size of this folder, as was returned by the POP3 STAT command when this folder was opened.

返回:
folder size
抛出:
IllegalStateException - if the folder isn't open
MessagingException

getSizes

public int[] getSizes()
               throws 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.

返回:
array of message sizes
抛出:
IllegalStateException - if the folder isn't open
MessagingException
从以下版本开始:
JavaMail 1.3.3

listCommand

public InputStream listCommand()
                        throws MessagingException,
                               IOException
Return the raw results of the POP3 LIST command with no arguments.

返回:
InputStream containing results
抛出:
IllegalStateException - if the folder isn't open
MessagingException
IOException
从以下版本开始:
JavaMail 1.3.3

finalize

protected void finalize()
                 throws Throwable
Close the folder when we're finalized.

覆盖:
Folder 中的 finalize
抛出:
Throwable

notifyMessageChangedListeners

protected void notifyMessageChangedListeners(int type,
                                             Message m)
从类 Folder 复制的描述
Notify all MessageChangedListeners. Folder implementations are expected to use this method to broadcast MessageChanged events.

The provided implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to registered MessageChangedListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems.

覆盖:
Folder 中的 notifyMessageChangedListeners


Copyright © 2013. All Rights Reserved.