|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.mail.Folder
com.sun.mail.imap.IMAPFolder
public class IMAPFolder
このクラスは 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. |
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)
指定されたメッセージをこのフォルダに追加します。 |
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. |
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)
このフォルダをサブスクライブ又はサブスクライブ解除します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| フィールドの詳細 |
|---|
protected String fullName
protected String name
protected int type
protected char separator
protected Flags availableFlags
protected Flags permanentFlags
protected boolean exists
protected boolean isNamespace
protected String[] attributes
protected com.sun.mail.imap.protocol.IMAPProtocol protocol
protected Vector messageCache
protected Object messageCacheLock
protected Hashtable uidTable
protected static final char UNKNOWN_SEPARATOR
| コンストラクタの詳細 |
|---|
protected IMAPFolder(String fullName,
char separator,
IMAPStore store)
fullName - このフォルダのフルネームseparator - このフォルダの名前空間の既定の区切り文字store - Store
protected IMAPFolder(String fullName,
char separator,
IMAPStore store,
boolean isNamespace)
fullName - このフォルダのフルネームseparator - このフォルダの名前空間の既定の区切り文字store - Store
protected IMAPFolder(com.sun.mail.imap.protocol.ListInfo li,
IMAPStore store)
| メソッドの詳細 |
|---|
public String getName()
Folder 内の getNamepublic String getFullName()
Folder 内の getFullName
public Folder getParent()
throws MessagingException
Folder 内の getParentMessagingException
public final boolean exists()
throws MessagingException
Folder 内の existsMessagingException - 一般にサーバへの接続が失われた場合Folder.create(int)
public Folder[] list(String pattern)
throws MessagingException
Folder 内の listpattern - 一致パターン
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolder.listSubscribed(java.lang.String)
public Folder[] listSubscribed(String pattern)
throws MessagingException
Folder 内の listSubscribedpattern - 一致パターン
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolder.list(java.lang.String)
public char getSeparator()
throws MessagingException
Folder 内の getSeparatorFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public final int getType()
throws MessagingException
Folder 内の getTypeFolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolder.HOLDS_FOLDERS,
Folder.HOLDS_MESSAGESpublic final boolean isSubscribed()
Folder 内の isSubscribed
public final void setSubscribed(boolean subscribe)
throws MessagingException
Folder 内の setSubscribedsubscribe - true to subscribe, false to unsubscribe
FolderNotFoundException - このフォルダが存在しない場合
MethodNotSupportedException - このストアがサブスクリプションをサポートしない場合
MessagingException
public boolean create(int type)
throws MessagingException
Folder 内の createtype - このフォルダの型
MessagingExceptionFolder.HOLDS_FOLDERS,
Folder.HOLDS_MESSAGES,
FolderEvent
public boolean hasNewMessages()
throws MessagingException
Folder 内の hasNewMessagesFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public Folder getFolder(String name)
throws MessagingException
Folder 内の getFoldername - Folder の名前
MessagingException
public boolean delete(boolean recurse)
throws MessagingException
Folder 内の deleteFolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolderEvent
public boolean renameTo(Folder f)
throws MessagingException
Folder 内の renameTof - この Folder の新しい名前を表すフォルダ
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolderEvent
public void open(int mode)
throws MessagingException
Folder 内の openmode - Folder READ_ONLY または READ_WRITE を開く
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolder.READ_ONLY,
Folder.READ_WRITE,
Folder.getType(),
ConnectionEvent
public void fetch(Message[] msgs,
FetchProfile fp)
throws MessagingException
Folder 内の fetchmsgs - これらのメッセージのフェッチ項目fp - FetchProfile
MessagingException
public void setFlags(Message[] msgs,
Flags flag,
boolean value)
throws MessagingException
Folder 内の setFlagsmsgs - メッセージオブジェクトの配列flag - 設定されるフラグを含む Flags オブジェクトvalue - フラグにこのブール値を設定する
MessagingExceptionMessage.setFlags(javax.mail.Flags, boolean),
MessageChangedEvent
public void close(boolean expunge)
throws MessagingException
Folder 内の closeexpunge - このフラグが true の場合、全ての削除メッセージを消去します。
MessagingExceptionConnectionEvent
public void forceClose()
throws MessagingException
MessagingExceptionpublic boolean isOpen()
Folder 内の isOpenpublic final Flags getPermanentFlags()
Folder 内の getPermanentFlags
public int getMessageCount()
throws MessagingException
Folder 内の getMessageCountFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public int getNewMessageCount()
throws MessagingException
Folder 内の getNewMessageCountFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public int getUnreadMessageCount()
throws MessagingException
Folder 内の getUnreadMessageCountFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public int getDeletedMessageCount()
throws MessagingException
Folder 内の getDeletedMessageCountFolderNotFoundException - このフォルダが存在しない場合
MessagingException
public Message getMessage(int msgnum)
throws MessagingException
Folder 内の getMessagemsgnum - メッセージ番号
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionFolder.getMessageCount(),
Folder.fetch(javax.mail.Message[], javax.mail.FetchProfile)
public void appendMessages(Message[] msgs)
throws MessagingException
Folder 内の appendMessagesmsgs - 追加される Message の配列
FolderNotFoundException - このフォルダが存在しない場合
MessagingException - 追加が失敗した場合
public void copyMessages(Message[] msgs,
Folder folder)
throws MessagingException
Folder 内の copyMessagesmsgs - メッセージオブジェクトの配列folder - メッセージのコピー先フォルダ
FolderNotFoundException - コピー先フォルダが存在しない場合
MessagingExceptionFolder.appendMessages(javax.mail.Message[])
public Message[] expunge()
throws MessagingException
Folder 内の expungeFolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionMessage.isExpunged(),
MessageCountEvent
public Message[] search(SearchTerm term)
throws MessagingException
Folder 内の searchterm - 検索基準
SearchException - 検索条件が複雑すぎて実装が処理できない場合
FolderNotFoundException - このフォルダが存在しない場合
MessagingExceptionSearchTerm
public Message[] search(SearchTerm term,
Message[] msgs)
throws MessagingException
Folder 内の searchterm - 検索基準msgs - 検索されるメッセージ
SearchException - 検索条件が複雑すぎて実装が処理できない場合
MessagingExceptionSearchTerm
public long getUIDValidity()
throws MessagingException
UIDFolder 内の getUIDValidityMessagingException
public long getUIDNext()
throws MessagingException
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.
MessagingException
public Message getMessageByUID(long uid)
throws MessagingException
null is returned.
UIDFolder 内の getMessageByUIDuid - 希望するメッセージの UID
null が返されます。
MessagingException
public Message[] getMessagesByUID(long start,
long end)
throws MessagingException
Returns Message objects for all valid messages in this range. Returns an empty array if no messages are found.
UIDFolder 内の getMessagesByUIDstart - 開始 UIDend - 終了 UID
MessagingExceptionUIDFolder.LASTUID
public Message[] getMessagesByUID(long[] uids)
throws MessagingException
uids.length() elements are returned.
If any UID in the array is invalid, a null entry
is returned for that element.
UIDFolder 内の getMessagesByUIDuids - UID の配列
MessagingException
public long getUID(Message message)
throws MessagingException
UIDFolder 内の getUIDmessage - このフォルダからのメッセージ
MessagingException
public final Quota[] getQuota()
throws MessagingException
MessagingException - if the server doesn't support the QUOTA extension
public final void setQuota(Quota quota)
throws MessagingException
getQuota method, but it
need not be.
quota - the quota to set
MessagingException - if the server doesn't support the QUOTA extension
public final ACL[] getACL()
throws MessagingException
MessagingException - if the server doesn't support the ACL extension
public final void addACL(ACL acl)
throws MessagingException
acl - the access control list entry to add
MessagingException - if the server doesn't support the ACL extension
public final void removeACL(String name)
throws MessagingException
name - the identifier for which to remove all ACL entries
MessagingException - if the server doesn't support the ACL extension
public final void addRights(ACL acl)
throws MessagingException
acl - the identifer and rights to add
MessagingException - if the server doesn't support the ACL extension
public final void removeRights(ACL acl)
throws MessagingException
acl - the identifer and rights to remove
MessagingException - if the server doesn't support the ACL extension
public final Rights[] listRights(String name)
throws MessagingException
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
MessagingException - if the server doesn't support the ACL extension
public final Rights myRights()
throws MessagingException
MessagingException - if the server doesn't support the ACL extension
public String[] getAttributes()
throws MessagingException
MessagingExceptionpublic final void handleResponse(com.sun.mail.iap.Response r)
com.sun.mail.iap.ResponseHandler 内の handleResponse
protected com.sun.mail.imap.protocol.IMAPProtocol getStoreProtocol()
throws com.sun.mail.iap.ProtocolException
com.sun.mail.iap.ProtocolExceptionpublic final com.sun.mail.imap.protocol.IMAPProtocol getProtocol()
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.
doCommand(com.sun.mail.imap.IMAPFolder.ProtocolCommand)
public final Object doCommand(IMAPFolder.ProtocolCommand cmd)
throws MessagingException
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
public final Object doOptionalCommand(String err,
IMAPFolder.ProtocolCommand cmd)
throws MessagingException
MessagingException
public final Object doCommandIgnoreFailure(IMAPFolder.ProtocolCommand cmd)
throws MessagingException
MessagingException
protected final Object doProtocolCommand(IMAPFolder.ProtocolCommand cmd)
throws com.sun.mail.iap.ProtocolException
com.sun.mail.iap.ProtocolExceptionprotected void releaseStoreProtocol(com.sun.mail.imap.protocol.IMAPProtocol p)
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||