com.sun.mail.pop3
クラス POP3Folder

java.lang.Object
  上位を拡張 javax.mail.Folder
      上位を拡張 com.sun.mail.pop3.POP3Folder

public final class POP3Folder
extends Folder

POP3 のフォルダです("INBOX" フォルダだけです)。 POP3 プロトコルプロバイダの詳細に関しては、 jp.sourceforge.livez.mail.pop3 パッケージのドキュメントを参照して下さい。


フィールドの概要
 
クラス 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)
          この Folder を閉じます。
 boolean create(int type)
          常に false を返します。
protected  POP3Message createMessage(Folder f, int msgno)
           
 boolean delete(boolean recurse)
          POP3 プロトコルは、INBOX が削除されるのを許可しないので、 常に MethodNotSupportedException をスローします。
 boolean exists()
          "INBOX" フォルダでは常に true です。
 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)
          POP3 フォルダはサブフォルダを含む事ができないので常に MessagingException をスローします。
 String getFullName()
          この Folder の完全な名前を返します。
 Message getMessage(int msgno)
          指定されたメッセージ番号に対応する Message オブジェクトを取得します。
 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()
          この Folder の名前を返します。
 Folder getParent()
          このフォルダの親フォルダを返します。
 Flags getPermanentFlags()
          POP3 プロトコルはどの様な永久フラグもサポートしないので、 常に空の Flags オブジェクトを返します。
 char getSeparator()
          POP3 では階層構造をサポートしないので常に NUL 文字を返します。
 int getSize()
          Return the size of this folder, as was returned by the POP3 STAT command when this folder was opened.
 int[] getSizes()
          POP3 LIST コマンドによって返される、このフォルダの全てのメッセージのサイズを返します。
 int getType()
          常に Folder.HOLDS_MESSAGES を返します。
 String getUID(Message msg)
          Return the unique ID string for this message, or null if not available.
 boolean hasNewMessages()
          常に false を返します。
 boolean isOpen()
          この Folder が 'open' 状態にあるかどうかを示します。
 Folder[] list(String pattern)
          POP3 フォルダはサブフォルダを含む事ができないので、 常に MessagingException を投げます。
 InputStream listCommand()
          Return the raw results of the POP3 LIST command with no arguments.
protected  void notifyMessageChangedListeners(int type, Message m)
          全ての MessageChangedListener に通知します。
 void open(int mode)
          このフォルダが "INBOX" と命名されない場合、 FolderNotFoundException をスローします。
 boolean renameTo(Folder f)
          POP3 プロトコルは、複数フォルダをサポートしないので、 常に MethodNotSupportedException をスローします。
 
クラス 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 の記述:
この Folder の名前を返します。

このメソッドは閉じた Folder 上で呼び出すことができます。

定義:
クラス Folder 内の getName
戻り値:
Folder の名前

getFullName

public String getFullName()
クラス Folder の記述:
この Folder の完全な名前を返します。 フォルダがこの Store のルート階層の下にある場合、 返される名前はルートへの相対名になります。 そうでない場合は、階層区切り文字で始まる絶対名が返されます。

このメソッドは閉じた Folder 上で呼び出す事ができます。

定義:
クラス Folder 内の getFullName
戻り値:
Folder の完全な名前

getParent

public Folder getParent()
クラス Folder の記述:
このフォルダの親フォルダを返します。 このメソッドは閉じた Folder 上で呼び出す事ができます。 このフォルダがフォルダ階層の最上位にある場合、このメソッドは null を返します。

Folder オブジェクトはキャッシュされないので、このメソッドを呼び出すと、 新規の異なる Folder オブジェクトが返されます。

定義:
クラス Folder 内の getParent
戻り値:
親フォルダ

exists

public boolean exists()
"INBOX" フォルダでは常に true です。それ以外の場合は常に false です。

定義:
クラス Folder 内の exists
戻り値:
INBOX は true、それ以外の場合は false
関連項目:
Folder.create(int)

list

public Folder[] list(String pattern)
              throws MessagingException
POP3 フォルダはサブフォルダを含む事ができないので、 常に MessagingException を投げます。

定義:
クラス Folder 内の list
パラメータ:
pattern - 一致パターン
戻り値:
一致する Folder オブジェクトの配列。一致する Folder が存在しない場合は、空の配列を返します。
例外:
MessagingException - 常に
関連項目:
Folder.listSubscribed(java.lang.String)

getSeparator

public char getSeparator()
POP3 では階層構造をサポートしないので常に NUL 文字を返します。

定義:
クラス Folder 内の getSeparator
戻り値:
NUL

getType

public int getType()
常に Folder.HOLDS_MESSAGES を返します。

定義:
クラス Folder 内の getType
戻り値:
Folder.HOLDS_MESSAGES
関連項目:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES

create

public boolean create(int type)
               throws MessagingException
常に false を返します。 POP3 プロトコルは、フォルダの作成をサポートしません。

定義:
クラス Folder 内の create
パラメータ:
type - このフォルダの型
戻り値:
false
例外:
MessagingException
関連項目:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES, FolderEvent

hasNewMessages

public boolean hasNewMessages()
                       throws MessagingException
常に false を返します。 POP3 プロトコルは新しいメッセージがいつ到着するかを決定する方法を全く提供しません。

定義:
クラス Folder 内の hasNewMessages
戻り値:
false
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getFolder

public Folder getFolder(String name)
                 throws MessagingException
POP3 フォルダはサブフォルダを含む事ができないので常に MessagingException をスローします。

定義:
クラス Folder 内の getFolder
パラメータ:
name - Folder の名前
戻り値:
Folder オブジェクト
例外:
MessagingException - 常に

delete

public boolean delete(boolean recurse)
               throws MessagingException
POP3 プロトコルは、INBOX が削除されるのを許可しないので、 常に MethodNotSupportedException をスローします。

定義:
クラス Folder 内の delete
戻り値:
Folder が正常に削除された場合は true
例外:
MethodNotSupportedException - 常に
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
FolderEvent

renameTo

public boolean renameTo(Folder f)
                 throws MessagingException
POP3 プロトコルは、複数フォルダをサポートしないので、 常に MethodNotSupportedException をスローします。

定義:
クラス Folder 内の renameTo
パラメータ:
f - この Folder の新しい名前を表すフォルダ
戻り値:
Folder の名前が正常に変更された場合は true
例外:
MethodNotSupportedException - 常に
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
FolderEvent

open

public void open(int mode)
          throws MessagingException
このフォルダが "INBOX" と命名されない場合、 FolderNotFoundException をスローします。

定義:
クラス Folder 内の open
パラメータ:
mode - Folder READ_ONLY または READ_WRITE を開く
例外:
FolderNotFoundException - INBOX がない場合
AuthenticationException - 認証に失敗した場合
MessagingException - その他の場合
関連項目:
Folder.READ_ONLY, Folder.READ_WRITE, Folder.getType(), ConnectionEvent

close

public void close(boolean expunge)
           throws MessagingException
クラス Folder の記述:
この Folder を閉じます。このメソッドは開いた Folder 上でのみ有効です。

この Folder 上に登録されている全ての ConnectionListener に CLOSED ConnectionEvent が配信されます。 MessagingException のスローにより、このメソッドが異常終了した場合でもフォルダは閉じられます。

定義:
クラス Folder 内の close
パラメータ:
expunge - このフラグが true の場合、全ての削除メッセージを消去します。
例外:
MessagingException
関連項目:
ConnectionEvent

isOpen

public boolean isOpen()
クラス Folder の記述:
この Folder が 'open' 状態にあるかどうかを示します。

定義:
クラス Folder 内の isOpen
戻り値:
この Folder が 'open' 状態にある場合は true

getPermanentFlags

public Flags getPermanentFlags()
POP3 プロトコルはどの様な永久フラグもサポートしないので、 常に空の Flags オブジェクトを返します。

定義:
クラス Folder 内の getPermanentFlags
戻り値:
空の Flags オブジェクト

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
戻り値:
メッセージの数。このメソッドが閉じたフォルダ上で呼び出された場合、 一部の実装では -1 が返されることがあります。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getMessage

public Message getMessage(int msgno)
                   throws MessagingException
クラス Folder の記述:
指定されたメッセージ番号に対応する Message オブジェクトを取得します。 Message オブジェクトのメッセージ番号は、この Message の Folder 中の相対位置です。 メッセージには 1 からフォルダ中のメッセージの数迄の番号が割り当てられます。 特定の Message のメッセージ番号は、Folder 中の他のメッセージが削除され、 Folder が消去された場合、セッション中に変更になる事があります。

Message オブジェクトは、オンデマンドで満たされる実際のメッセージへの軽量な参照です。 従って、Folder 実装は軽量な Message オブジェクトを提供する必要があります。

Folder オブジェクトと異なり、同じメッセージ番号を使用して繰り返し getMessage を呼び出した場合、 このフォルダで消去されたメッセージがない限り、同じ Message オブジェクトが返されます。

フォルダが消去されると、セッション中にメッセージ番号が変更になる事がある為、 クライアントはメッセージへの参照としてメッセージ番号を使用するべきではありません。 代わりに Message オブジェクトを使用して下さい。

定義:
クラス Folder 内の getMessage
パラメータ:
msgno - メッセージ番号
戻り値:
Message オブジェクト
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
Folder.getMessageCount(), Folder.fetch(javax.mail.Message[], javax.mail.FetchProfile)

createMessage

protected POP3Message createMessage(Folder f,
                                    int msgno)

appendMessages

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

定義:
クラス Folder 内の appendMessages
パラメータ:
msgs - 追加される Message の配列
例外:
MethodNotSupportedException - 常に
FolderNotFoundException - このフォルダが存在しない場合
MessagingException - 追加が失敗した場合

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
戻り値:
消去された Message オブジェクトの配列
例外:
MethodNotSupportedException - 常に
FolderNotFoundException - このフォルダが存在しない場合
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 - これらのメッセージのフェッチ項目
fp - 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.

戻り値:
ユニークな ID 文字列
例外:
MessagingException

getSize

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

戻り値:
フォルダサイズ
例外:
IllegalStateException - フォルダが開かれていない場合

getSizes

public int[] getSizes()
               throws MessagingException
POP3 LIST コマンドによって返される、このフォルダの全てのメッセージのサイズを返します。 配列の各エントリーはメッセージに対応しています; エントリーは、メッセージ番号 i+1 に対応します。

戻り値:
メッセージサイズの配列
例外:
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 の記述:
全ての MessageChangedListener に通知します。 Folder 実装はこのメソッドを使用して、MessageChanged イベントをブロードキャストする必要があります。

提供される実装は、イベントを内部イベントキューに入れます。 イベントディスパッチャスレッドはキューからイベントを出し、 登録された MessageChangedListener にディスパッチします。 イベントディスパッチは別個のスレッドで起こる為、デッドロック問題を防ぎます。

オーバーライド:
クラス Folder 内の notifyMessageChangedListeners