com.sun.mail.imap
クラス IMAPFolder

java.lang.Object
  上位を拡張 javax.mail.Folder
      上位を拡張 com.sun.mail.imap.IMAPFolder
すべての実装されたインタフェース:
com.sun.mail.iap.ResponseHandler, UIDFolder
直系の既知のサブクラス:
DefaultFolder

public class IMAPFolder
extends Folder
implements UIDFolder, com.sun.mail.iap.ResponseHandler

このクラスは IMAP フォルダを実装します。

閉じている IMAPFolder オブジェクトは IMAPStore オブジェクトとのプロトコル接続を共有します。

Applications that need to make use of IMAP-specific features may cast a Folder object to an IMAPFolder object and use the methods on this class. The getQuota and setQuota methods support the IMAP QUOTA extension. Refer to RFC 2087 for more information.

The getACL, addACL, removeACL, addRights, removeRights, listRights, and myRights methods support the IMAP ACL extension. Refer to RFC 2086 for more information.

The doCommand method and IMAPFolder.ProtocolCommand interface support use of arbitrary IMAP protocol commands.

See the jp.sourceforge.livez.mail.imap package documentation for further information on the IMAP protocol provider.

WARNING: The APIs unique to this class should be considered EXPERIMENTAL. They may be changed in the future in ways that are incompatible with applications using the current APIs.


入れ子のクラスの概要
static class IMAPFolder.FetchProfileItem
          フェッチされるヘッダ群のフェッチプロフィール項目です。
static interface IMAPFolder.ProtocolCommand
          ユーザ定義用 IMAP プロトコルコマンドのシンプルなインターフェイスです。
 
フィールドの概要
protected  String[] attributes
           
protected  Flags availableFlags
           
protected  boolean exists
           
protected  String fullName
           
protected  boolean isNamespace
           
protected  Vector messageCache
           
protected  Object messageCacheLock
           
protected  String name
           
protected  Flags permanentFlags
           
protected  com.sun.mail.imap.protocol.IMAPProtocol protocol
           
protected  char separator
           
protected  int type
           
protected  Hashtable uidTable
           
protected static char UNKNOWN_SEPARATOR
           
 
クラス javax.mail.Folder から継承されたフィールド
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
インタフェース javax.mail.UIDFolder から継承されたフィールド
LASTUID
 
コンストラクタの概要
protected IMAPFolder(com.sun.mail.imap.protocol.ListInfo li, IMAPStore store)
          Constructor used to create an existing folder.
protected IMAPFolder(String fullName, char separator, IMAPStore store)
          Constructor used to create a possibly non-existent folder.
protected IMAPFolder(String fullName, char separator, IMAPStore store, boolean isNamespace)
          Constructor used to create a possibly non-existent folder.
 
メソッドの概要
 void addACL(ACL acl)
          Add an access control list entry to the access control list for this folder.
 Message[] addMessages(Message[] msgs)
          Append the given messages into this folder.
 void addRights(ACL acl)
          Add the rights specified in the ACL to the entry for the identifier specified in the ACL.
 void appendMessages(Message[] msgs)
          指定されたメッセージをこのフォルダに追加します。
 AppendUID[] appendUIDMessages(Message[] msgs)
          Append the given messages into this folder.
 void close(boolean expunge)
          このフォルダを閉じます。
 void copyMessages(Message[] msgs, Folder folder)
          このフォルダから指定された別のフォルダへ指定されたメッセージをコピーします。
 boolean create(int type)
          指定された型でこのフォルダを作成します。
 boolean delete(boolean recurse)
          このフォルダを削除します。
 Object doCommand(IMAPFolder.ProtocolCommand cmd)
          ユーザによって供給された IMAP コマンドを実行します。
 Object doCommandIgnoreFailure(IMAPFolder.ProtocolCommand cmd)
           
 Object doOptionalCommand(String err, IMAPFolder.ProtocolCommand cmd)
           
protected  Object doProtocolCommand(IMAPFolder.ProtocolCommand cmd)
           
 boolean exists()
          このフォルダが本当にサーバ上に存在するかどうかを検査します。
 Message[] expunge()
          Expunge all messages marked as DELETED.
 Message[] expunge(Message[] msgs)
          Expunge the indicated messages, which must have been marked as DELETED.
 void fetch(Message[] msgs, FetchProfile fp)
          プリフェッチ属性 (指定された FetchProfile に基づく)。
 void forceClose()
          サーバーを待つことなく、このフォルダを閉じます。
 ACL[] getACL()
          Get the access control list entries for this folder.
 String[] getAttributes()
          IMAP サーバが LIST レスポンスと共に返す属性を取得します。
 int getDeletedMessageCount()
          削除済みメッセージの数を取得します。
 Folder getFolder(String name)
          指定された名前に対応するサブフォルダを取得します。
 String getFullName()
          この Folder の完全な名前を返します。
 Message getMessage(int msgnum)
          指定されたメッセージを取得します。
 Message getMessageByUID(long uid)
          Get the Message corresponding to the given UID.
 int getMessageCount()
          メッセージ総数を取得します。
 Message[] getMessagesByUID(long[] uids)
          Get the Messages specified by the given array.
 Message[] getMessagesByUID(long start, long end)
          Get the Messages specified by the given range.
 String getName()
          この Folder の名前を返します。
 int getNewMessageCount()
          新規メッセージの数を取得します。
 Folder getParent()
          このフォルダの親フォルダを返します。
 Flags getPermanentFlags()
          サーバがサポートする永続フラグを返します。
 com.sun.mail.imap.protocol.IMAPProtocol getProtocol()
          このフォルダの IMAPProtocol オブジェクトを返します。
 Quota[] getQuota()
          Get the quotas for the quotaroot associated with this folder.
 char getSeparator()
          区切り文字を返します。
protected  com.sun.mail.imap.protocol.IMAPProtocol getStoreProtocol()
          このフォルダのストアのプロトコル接続を取得します。
 int getType()
          このフォルダの型を返します。
 long getUID(Message message)
          指定されたメッセージの UID を取得します。
 long getUIDNext()
          Returns the predicted UID that will be assigned to the next message that is appended to this folder.
 long getUIDValidity()
          このフォルダの UIDValidity を返します。
 int getUnreadMessageCount()
          未読メッセージの数を取得します。
 void handleResponse(com.sun.mail.iap.Response r)
          レスポンスハンドラ。
 boolean hasNewMessages()
          このフォルダに新規メッセージが存在するか検査します。
 boolean isOpen()
          この接続が本当にオープンであるか検査します。
 boolean isSubscribed()
          このフォルダがサブスクライブされか検査します。
 Folder[] list(String pattern)
          指定されたパターンに一致する全てのサブフォルダの一覧を返します。
 Rights[] listRights(String name)
          Get all the rights that may be allowed to the given identifier.
 Folder[] listSubscribed(String pattern)
          指定されたパターンに一致するサブスクライブされた全てのサブフォルダの一覧を返します。
 Rights myRights()
          Get the rights allowed to the currently authenticated user.
 void open(int mode)
          指定されたモードでこのフォルダを開きます。
protected  void releaseStoreProtocol(com.sun.mail.imap.protocol.IMAPProtocol p)
          ストアプロトコルオブジェクトを解放します。
 void removeACL(String name)
          Remove any access control list entry for the given identifier from the access control list for this folder.
 void removeRights(ACL acl)
          Remove the rights specified in the ACL from the entry for the identifier specified in the ACL.
 boolean renameTo(Folder f)
          このフォルダの名前を変更します。
 Message[] search(SearchTerm term)
          指定された検索基準に一致するメッセージについてフォルダを検索します。
 Message[] search(SearchTerm term, Message[] msgs)
          Search the folder for messages matching the given term.
 void setFlags(Message[] msgs, Flags flag, boolean value)
          メッセージ配列中のメッセージに指定されたフラグを設定します。
 void setQuota(Quota quota)
          Set the quotas for the quotaroot specified in the quota argument.
 void setSubscribed(boolean subscribe)
          このフォルダをサブスクライブ又はサブスクライブ解除します。
 
クラス javax.mail.Folder から継承されたメソッド
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, finalize, getMessages, getMessages, getMessages, getMode, getStore, getURLName, list, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, setFlags, setFlags, toString
 
クラス java.lang.Object から継承されたメソッド
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

fullName

protected String fullName

name

protected String name

type

protected int type

separator

protected char separator

availableFlags

protected Flags availableFlags

permanentFlags

protected Flags permanentFlags

exists

protected boolean exists

isNamespace

protected boolean isNamespace

attributes

protected String[] attributes

protocol

protected com.sun.mail.imap.protocol.IMAPProtocol protocol

messageCache

protected Vector messageCache

messageCacheLock

protected Object messageCacheLock

uidTable

protected Hashtable uidTable

UNKNOWN_SEPARATOR

protected static final char UNKNOWN_SEPARATOR
関連項目:
定数フィールド値
コンストラクタの詳細

IMAPFolder

protected IMAPFolder(String fullName,
                     char separator,
                     IMAPStore store)
Constructor used to create a possibly non-existent folder.

パラメータ:
fullName - このフォルダのフルネーム
separator - このフォルダの名前空間の既定の区切り文字
store - Store

IMAPFolder

protected IMAPFolder(String fullName,
                     char separator,
                     IMAPStore store,
                     boolean isNamespace)
Constructor used to create a possibly non-existent folder.

パラメータ:
fullName - このフォルダのフルネーム
separator - このフォルダの名前空間の既定の区切り文字
store - Store

IMAPFolder

protected IMAPFolder(com.sun.mail.imap.protocol.ListInfo li,
                     IMAPStore store)
Constructor used to create an existing folder.

メソッドの詳細

getName

public String getName()
この Folder の名前を返します。

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

getFullName

public String getFullName()
この Folder の完全な名前を返します。

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

getParent

public Folder getParent()
                 throws MessagingException
このフォルダの親フォルダを返します。

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

exists

public final boolean exists()
                     throws MessagingException
このフォルダが本当にサーバ上に存在するかどうかを検査します。

定義:
クラス Folder 内の exists
戻り値:
フォルダが存在する場合は true、そうでない場合は false
例外:
MessagingException - 一般にサーバへの接続が失われた場合
関連項目:
Folder.create(int)

list

public Folder[] list(String pattern)
              throws MessagingException
指定されたパターンに一致する全てのサブフォルダの一覧を返します。

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

listSubscribed

public Folder[] listSubscribed(String pattern)
                        throws MessagingException
指定されたパターンに一致するサブスクライブされた全てのサブフォルダの一覧を返します。

オーバーライド:
クラス Folder 内の listSubscribed
パラメータ:
pattern - 一致パターン
戻り値:
一致するサブスクライブされた Folder オブジェクトの配列。 一致するサブスクライブされたフォルダが存在しない場合は、空の配列を返します。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
Folder.list(java.lang.String)

getSeparator

public char getSeparator()
                  throws MessagingException
区切り文字を返します。

定義:
クラス Folder 内の getSeparator
戻り値:
階層区切り文字
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getType

public final int getType()
                  throws MessagingException
このフォルダの型を返します。

定義:
クラス Folder 内の getType
戻り値:
適切なビットが設定された整数
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES

isSubscribed

public final boolean isSubscribed()
このフォルダがサブスクライブされか検査します。

オーバーライド:
クラス Folder 内の isSubscribed
戻り値:
この Folder がサブスクライブされる場合は true

setSubscribed

public final void setSubscribed(boolean subscribe)
                         throws MessagingException
このフォルダをサブスクライブ又はサブスクライブ解除します。

オーバーライド:
クラス Folder 内の setSubscribed
パラメータ:
subscribe - true to subscribe, false to unsubscribe
例外:
FolderNotFoundException - このフォルダが存在しない場合
MethodNotSupportedException - このストアがサブスクリプションをサポートしない場合
MessagingException

create

public boolean create(int type)
               throws MessagingException
指定された型でこのフォルダを作成します。

定義:
クラス Folder 内の create
パラメータ:
type - このフォルダの型
戻り値:
作成が成功する場合は true、そうでない場合は false
例外:
MessagingException
関連項目:
Folder.HOLDS_FOLDERS, Folder.HOLDS_MESSAGES, FolderEvent

hasNewMessages

public boolean hasNewMessages()
                       throws MessagingException
このフォルダに新規メッセージが存在するか検査します。

定義:
クラス Folder 内の hasNewMessages
戻り値:
Store が新規の Message を含む場合は true
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getFolder

public Folder getFolder(String name)
                 throws MessagingException
指定された名前に対応するサブフォルダを取得します。

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

delete

public boolean delete(boolean recurse)
               throws MessagingException
このフォルダを削除します。

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

renameTo

public boolean renameTo(Folder f)
                 throws MessagingException
このフォルダの名前を変更します。

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

open

public void open(int mode)
          throws MessagingException
指定されたモードでこのフォルダを開きます。

定義:
クラス Folder 内の open
パラメータ:
mode - Folder READ_ONLY または READ_WRITE を開く
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
Folder.READ_ONLY, Folder.READ_WRITE, Folder.getType(), ConnectionEvent

fetch

public void fetch(Message[] msgs,
                  FetchProfile fp)
           throws MessagingException
プリフェッチ属性 (指定された FetchProfile に基づく)。

オーバーライド:
クラス Folder 内の fetch
パラメータ:
msgs - これらのメッセージのフェッチ項目
fp - FetchProfile
例外:
MessagingException

setFlags

public void setFlags(Message[] msgs,
                     Flags flag,
                     boolean value)
              throws MessagingException
メッセージ配列中のメッセージに指定されたフラグを設定します。

オーバーライド:
クラス Folder 内の setFlags
パラメータ:
msgs - メッセージオブジェクトの配列
flag - 設定されるフラグを含む Flags オブジェクト
value - フラグにこのブール値を設定する
例外:
MessagingException
関連項目:
Message.setFlags(javax.mail.Flags, boolean), MessageChangedEvent

close

public void close(boolean expunge)
           throws MessagingException
このフォルダを閉じます。

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

forceClose

public void forceClose()
                throws MessagingException
サーバーを待つことなく、このフォルダを閉じます。

例外:
MessagingException
導入されたバージョン:
JavaMail 1.3.3

isOpen

public boolean isOpen()
この接続が本当にオープンであるか検査します。

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

getPermanentFlags

public final Flags getPermanentFlags()
サーバがサポートする永続フラグを返します。

定義:
クラス Folder 内の getPermanentFlags
戻り値:
永続フラグ、または不明の場合は null

getMessageCount

public int getMessageCount()
                    throws MessagingException
メッセージ総数を取得します。

定義:
クラス Folder 内の getMessageCount
戻り値:
メッセージの数。このメソッドが閉じたフォルダ上で呼び出された場合、 一部の実装では -1 が返されることがあります。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getNewMessageCount

public int getNewMessageCount()
                       throws MessagingException
新規メッセージの数を取得します。

オーバーライド:
クラス Folder 内の getNewMessageCount
戻り値:
新規メッセージの数。このメソッドが閉じたフォルダ上で呼び出された場合、 一部の実装では -1 が返される事があります。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getUnreadMessageCount

public int getUnreadMessageCount()
                          throws MessagingException
未読メッセージの数を取得します。

オーバーライド:
クラス Folder 内の getUnreadMessageCount
戻り値:
未読メッセージの数。このメソッドが閉じたフォルダ上で呼び出された場合、 一部の実装では -1 が返される事があります。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getDeletedMessageCount

public int getDeletedMessageCount()
                           throws MessagingException
削除済みメッセージの数を取得します。

オーバーライド:
クラス Folder 内の getDeletedMessageCount
戻り値:
削除済みメッセージの数。このメソッドが閉じたフォルダ上で呼び出された場合、 一部の実装では -1 が返される事があります。
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException

getMessage

public Message getMessage(int msgnum)
                   throws MessagingException
指定されたメッセージを取得します。

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

appendMessages

public void appendMessages(Message[] msgs)
                    throws MessagingException
指定されたメッセージをこのフォルダに追加します。

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

appendUIDMessages

public AppendUID[] appendUIDMessages(Message[] msgs)
                              throws MessagingException
Append the given messages into this folder. Return array of AppendUID objects containing UIDs of these messages in the destination folder. Each element of the returned array corresponds to an element of the msgs array. A null element means the server didn't return UID information for the appended message.

Depends on the APPENDUID response code defined by the UIDPLUS extension - RFC 2359.

例外:
MessagingException

addMessages

public Message[] addMessages(Message[] msgs)
                      throws MessagingException
Append the given messages into this folder. Return array of Message objects representing the messages in the destination folder. Note that the folder must be open. Each element of the returned array corresponds to an element of the msgs array. A null element means the server didn't return UID information for the appended message.

Depends on the APPENDUID response code defined by the UIDPLUS extension - RFC 2359.

例外:
MessagingException

copyMessages

public void copyMessages(Message[] msgs,
                         Folder folder)
                  throws MessagingException
このフォルダから指定された別のフォルダへ指定されたメッセージをコピーします。

オーバーライド:
クラス Folder 内の copyMessages
パラメータ:
msgs - メッセージオブジェクトの配列
folder - メッセージのコピー先フォルダ
例外:
FolderNotFoundException - コピー先フォルダが存在しない場合
MessagingException
関連項目:
Folder.appendMessages(javax.mail.Message[])

expunge

public Message[] expunge()
                  throws MessagingException
Expunge all messages marked as DELETED.

定義:
クラス Folder 内の expunge
戻り値:
消去された Message オブジェクトの配列
例外:
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
Message.isExpunged(), MessageCountEvent

expunge

public Message[] expunge(Message[] msgs)
                  throws MessagingException
Expunge the indicated messages, which must have been marked as DELETED.

例外:
MessagingException

search

public Message[] search(SearchTerm term)
                 throws MessagingException
指定された検索基準に一致するメッセージについてフォルダを検索します。

オーバーライド:
クラス Folder 内の search
パラメータ:
term - 検索基準
戻り値:
一致するメッセージの配列
例外:
SearchException - 検索条件が複雑すぎて実装が処理できない場合
FolderNotFoundException - このフォルダが存在しない場合
MessagingException
関連項目:
SearchTerm

search

public Message[] search(SearchTerm term,
                        Message[] msgs)
                 throws MessagingException
Search the folder for messages matching the given term. Returns array of matching messages. Returns an empty array if no matching messages are found.

オーバーライド:
クラス Folder 内の search
パラメータ:
term - 検索基準
msgs - 検索されるメッセージ
戻り値:
一致するメッセージの配列
例外:
SearchException - 検索条件が複雑すぎて実装が処理できない場合
MessagingException
関連項目:
SearchTerm

getUIDValidity

public long getUIDValidity()
                    throws MessagingException
このフォルダの UIDValidity を返します。

定義:
インタフェース UIDFolder 内の getUIDValidity
戻り値:
UIDValidity
例外:
MessagingException

getUIDNext

public long getUIDNext()
                throws MessagingException
Returns the predicted UID that will be assigned to the next message that is appended to this folder. If the folder is closed, the STATUS command is used to retrieve this value. If the folder is open, the value returned from the SELECT or EXAMINE command is returned. Note that messages may have been appended to the folder while it was open and thus this value may be out of date.

Servers implementing RFC2060 likely won't return this value when a folder is opened. Servers implementing RFC3501 should return this value when a folder is opened.

戻り値:
UIDNEXT 値、又は不明な場合 -1
例外:
MessagingException
導入されたバージョン:
JavaMail 1.3.3

getMessageByUID

public Message getMessageByUID(long uid)
                        throws MessagingException
Get the Message corresponding to the given UID. If no such message exists, null is returned.

定義:
インタフェース UIDFolder 内の getMessageByUID
パラメータ:
uid - 希望するメッセージの UID
戻り値:
Message オブジェクトです。 この UID に対応するメッセージが取得されない場合は、null が返されます。
例外:
MessagingException

getMessagesByUID

public Message[] getMessagesByUID(long start,
                                  long end)
                           throws MessagingException
Get the Messages specified by the given range.

Returns Message objects for all valid messages in this range. Returns an empty array if no messages are found.

定義:
インタフェース UIDFolder 内の getMessagesByUID
パラメータ:
start - 開始 UID
end - 終了 UID
戻り値:
Message オブジェクトの配列
例外:
MessagingException
関連項目:
UIDFolder.LASTUID

getMessagesByUID

public Message[] getMessagesByUID(long[] uids)
                           throws MessagingException
Get the Messages specified by the given array.

uids.length() elements are returned. If any UID in the array is invalid, a null entry is returned for that element.

定義:
インタフェース UIDFolder 内の getMessagesByUID
パラメータ:
uids - UID の配列
戻り値:
Message オブジェクトの配列
例外:
MessagingException

getUID

public long getUID(Message message)
            throws MessagingException
指定されたメッセージの UID を取得します。

定義:
インタフェース UIDFolder 内の getUID
パラメータ:
message - このフォルダからのメッセージ
戻り値:
このメッセージの UID
例外:
MessagingException

getQuota

public final Quota[] getQuota()
                       throws MessagingException
Get the quotas for the quotaroot associated with this folder. Note that many folders may have the same quotaroot. Quotas are controlled on the basis of a quotaroot, not (necessarily) a folder. The relationship between folders and quotaroots depends on the IMAP server. Some servers might implement a single quotaroot for all folders owned by a user. Other servers might implement a separate quotaroot for each folder. A single folder can even have multiple quotaroots, perhaps controlling quotas for different resources.

戻り値:
array of Quota objects for the quotaroots associated with this folder
例外:
MessagingException - if the server doesn't support the QUOTA extension

setQuota

public final void setQuota(Quota quota)
                    throws MessagingException
Set the quotas for the quotaroot specified in the quota argument. Typically this will be one of the quotaroots associated with this folder, as obtained from the getQuota method, but it need not be.

パラメータ:
quota - the quota to set
例外:
MessagingException - if the server doesn't support the QUOTA extension

getACL

public final ACL[] getACL()
                   throws MessagingException
Get the access control list entries for this folder.

戻り値:
array of access control list entries
例外:
MessagingException - if the server doesn't support the ACL extension

addACL

public final void addACL(ACL acl)
                  throws MessagingException
Add an access control list entry to the access control list for this folder.

パラメータ:
acl - the access control list entry to add
例外:
MessagingException - if the server doesn't support the ACL extension

removeACL

public final void removeACL(String name)
                     throws MessagingException
Remove any access control list entry for the given identifier from the access control list for this folder.

パラメータ:
name - the identifier for which to remove all ACL entries
例外:
MessagingException - if the server doesn't support the ACL extension

addRights

public final void addRights(ACL acl)
                     throws MessagingException
Add the rights specified in the ACL to the entry for the identifier specified in the ACL. If an entry for the identifier doesn't already exist, add one.

パラメータ:
acl - the identifer and rights to add
例外:
MessagingException - if the server doesn't support the ACL extension

removeRights

public final void removeRights(ACL acl)
                        throws MessagingException
Remove the rights specified in the ACL from the entry for the identifier specified in the ACL.

パラメータ:
acl - the identifer and rights to remove
例外:
MessagingException - if the server doesn't support the ACL extension

listRights

public final Rights[] listRights(String name)
                          throws MessagingException
Get all the rights that may be allowed to the given identifier. Rights are grouped per RFC 2086 and each group is returned as an element of the array. The first element of the array is the set of rights that are always granted to the identifier. Later elements are rights that may be optionally granted to the identifier.

Note that this method lists the rights that it is possible to assign to the given identifier, not the rights that are actually granted to the given identifier. For the latter, see the getACL method.

パラメータ:
name - the identifier to list rights for
戻り値:
array of Rights objects representing possible rights for the identifier
例外:
MessagingException - if the server doesn't support the ACL extension

myRights

public final Rights myRights()
                      throws MessagingException
Get the rights allowed to the currently authenticated user.

戻り値:
the rights granted to the current user
例外:
MessagingException - if the server doesn't support the ACL extension

getAttributes

public String[] getAttributes()
                       throws MessagingException
IMAP サーバが LIST レスポンスと共に返す属性を取得します。

例外:
MessagingException
導入されたバージョン:
JavaMail 1.3.3

handleResponse

public final void handleResponse(com.sun.mail.iap.Response r)
レスポンスハンドラ。 これはプロトコル層によって呼び出されるコールバックルーチンです。

定義:
インタフェース com.sun.mail.iap.ResponseHandler 内の handleResponse

getStoreProtocol

protected com.sun.mail.imap.protocol.IMAPProtocol getStoreProtocol()
                                                            throws com.sun.mail.iap.ProtocolException
このフォルダのストアのプロトコル接続を取得します。 When acquiring a store protocol object, it is important to use the following steps: IMAPProtocol p = null; try { p = getStoreProtocol(); // コマンドを実行します } catch (WhateverException ex) { // 例外をハンドリングします } finally { releaseStoreProtocol(p); }

例外:
com.sun.mail.iap.ProtocolException

getProtocol

public final com.sun.mail.imap.protocol.IMAPProtocol getProtocol()
このフォルダの IMAPProtocol オブジェクトを返します。

NOTE: This method was intended to allow experimentation with simple extension commands that can use the low level Protocol object APIs to send commands and process responses.

NOTE: Using this protocol object is completely UNSAFE because there's no way to aquire the required locks. See the doCommand method for a safe alternative.

戻り値:
フォルダが開いている場合に使用される IMAPProtocol オブジェクト
関連項目:
doCommand(com.sun.mail.imap.IMAPFolder.ProtocolCommand)

doCommand

public final Object doCommand(IMAPFolder.ProtocolCommand cmd)
                       throws MessagingException
ユーザによって供給された IMAP コマンドを実行します。 The command is executed in the appropriate context with the necessary locks held and using the appropriate IMAPProtocol object.

This method returns whatever the ProtocolCommand object's doCommand method returns. If the doCommand method throws a ConnectionException it is translated into a StoreClosedException or FolderClosedException as appropriate. If the doCommand method throws a ProtocolException it is translated into a MessagingException.

The following example shows how to execute the IMAP NOOP command. Executing more complex IMAP commands requires intimate knowledge of the com.sun.mail.iap and com.sun.mail.imap.protocol packages, best acquired by reading the source code.

 import com.sun.mail.iap.*;
 import com.sun.mail.imap.*;
 import com.sun.mail.imap.protocol.*;
 
 ...
 
 IMAPFolder f = (IMAPFolder)folder;
 Object val = f.doCommand(new IMAPFolder.ProtocolCommand() {
        public Object doCommand(IMAPProtocol p) throws ProtocolException {
                p.simpleCommand("NOOP", null);
                return null;
        }
 });
 

Here's a more complex example showing how to use the proposed IMAP SORT extension:

import com.sun.mail.iap.*; import com.sun.mail.imap.*; import com.sun.mail.imap.protocol.*; ... IMAPFolder f = (IMAPFolder)folder; Object val = f.doCommand(new IMAPFolder.ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { // Issue command Argument args = new Argument(); Argument list = new Argument(); list.writeString("SUBJECT"); args.writeArgument(list); args.writeString("UTF-8"); args.writeString("ALL"); Response[] r = p.command("SORT", args); Response response = r[r.length-1]; // Grab response Vector v = new Vector(); if (response.isOK()) { // command succesful for (int i = 0, len = r.length; i < len; i++) { if (!(r[i] instanceof IMAPResponse)) continue; IMAPResponse ir = (IMAPResponse) r[i]; if (ir.keyEquals("SORT")) { String num; while ((num = ir.readAtomString()) != null) System.out.println(num); r[i] = null; } } } // dispatch remaining untagged responses p.notifyResponseHandlers(r); p.handleResult(response); return null; } });

例外:
MessagingException

doOptionalCommand

public final Object doOptionalCommand(String err,
                                      IMAPFolder.ProtocolCommand cmd)
                               throws MessagingException
例外:
MessagingException

doCommandIgnoreFailure

public final Object doCommandIgnoreFailure(IMAPFolder.ProtocolCommand cmd)
                                    throws MessagingException
例外:
MessagingException

doProtocolCommand

protected final Object doProtocolCommand(IMAPFolder.ProtocolCommand cmd)
                                  throws com.sun.mail.iap.ProtocolException
例外:
com.sun.mail.iap.ProtocolException

releaseStoreProtocol

protected void releaseStoreProtocol(com.sun.mail.imap.protocol.IMAPProtocol p)
ストアプロトコルオブジェクトを解放します。 If we borrowed a protocol object from the connection pool, give it back. If we used our own protocol object, nothing to do.