|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.mail Class FetchProfile
java.lang.Object javax.mail.FetchProfile
public class FetchProfile
- extends Object
客户端使用 FetchProfile 列出希望从服务器预获取的某一范围消息的 Message 属性。
从 Folder 获得的消息是轻量级对象,这些对象开始通常作为对实际消息的空引用。当对该特定 Message 调用适当的 get*() 方法时,才“按需”填充这样的 Message 对象。某些基于服务器的消息访问协议 (Ex:IMAP) 允许在单个请求中批量获取某一范围消息的消息属性。想要使用某一范围 Message 的消息属性的客户端(例如,要显示头列表中顶级头的客户端)可能需要使用这类服务器提供的优化。FetchProfile
允许客户端向服务器指示此需求。
注意,实现并不一定会支持 FetchProfile,因为可能存在后端服务不允许简单有效地获取这类配置文件的情况。
说明 FetchProfile 用法的示例代码如下所示:
Message[] msgs = folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); fp.add("X-mailer"); folder.fetch(msgs, fp);
See also | fetch |
Clients use a FetchProfile to list the Message attributes that it wishes to prefetch from the server for a range of messages.
Messages obtained from a Folder are light-weight objects that
typically start off as empty references to the actual messages.
Such a Message object is filled in "on-demand" when the appropriate
get*() methods are invoked on that particular Message. Certain
server-based message access protocols (Ex: IMAP) allow batch
fetching of message attributes for a range of messages in a single
request. Clients that want to use message attributes for a range of
Messages (Example: to display the top-level headers in a headerlist)
might want to use the optimization provided by such servers. The
FetchProfile
allows the client to indicate this desire
to the server.
Note that implementations are not obligated to support FetchProfiles, since there might be cases where the backend service does not allow easy, efficient fetching of such profiles.
Sample code that illustrates the use of a FetchProfile is given below:
Message[] msgs = folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); fp.add("X-mailer"); folder.fetch(msgs, fp);
- Author:
- John Mani, Bill Shannon
- See Also:
Folder.fetch(javax.mail.Message[], javax.mail.FetchProfile)
Nested Class Summary | |
---|---|
static class |
FetchProfile.Item
This inner class is the base class of all items that can be requested in a FetchProfile. |
Constructor Summary | |
---|---|
FetchProfile()
Create an empty FetchProfile. |
Method Summary | |
---|---|
void |
add(FetchProfile.Item item)
Add the given special item as one of the attributes to be prefetched. |
void |
add(String headerName)
Add the specified header-field to the list of attributes to be prefetched. |
boolean |
contains(FetchProfile.Item item)
Returns true if the fetch profile contains given special item. |
boolean |
contains(String headerName)
Returns true if the fetch profile contains given header name. |
String[] |
getHeaderNames()
Get the names of the header-fields set in this profile. |
FetchProfile.Item[] |
getItems()
Get the items set in this profile. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public
FetchProfile()
创建一个空 FetchProfile。
英文文档:
FetchProfile
public FetchProfile()
- Create an empty FetchProfile.
Method Detail |
---|
public void
add(FetchProfile.Item item)
将给定特殊项作为要预获取的属性之一添加。
item | 要获取的特殊项 |
See also | ENVELOPE, CONTENT_INFO, FLAGS |
add
public void add(FetchProfile.Item item)
- Add the given special item as one of the attributes to
be prefetched.
- Parameters:
item
- the special item to be fetched- See Also:
FetchProfile.Item.ENVELOPE
,FetchProfile.Item.CONTENT_INFO
,FetchProfile.Item.FLAGS
public void
add(String headerName)
将指定头字段添加到要预获取的属性的列表中。
headerName | 要预获取的头 |
add
public void add(String headerName)
- Add the specified header-field to the list of attributes
to be prefetched.
- Parameters:
headerName
- header to be prefetched
public boolean
contains(FetchProfile.Item item)
如果 fetch 配置文件包含给定特殊项,则返回 true。
英文文档:
contains
public boolean contains(FetchProfile.Item item)
- Returns true if the fetch profile contains given special item.
public boolean
contains(String headerName)
如果 fetch 配置文件包含给定头名称,则返回 true。
英文文档:
contains
public boolean contains(String headerName)
- Returns true if the fetch profile contains given header name.
public FetchProfile.Item[]
getItems()
获取此配置文件中设置的项。
return | 此配置文件中设置的项 |
getItems
public FetchProfile.Item[] getItems()
- Get the items set in this profile.
- Returns:
- items set in this profile
public String[]
getHeaderNames()
获取此配置文件中设置的头字段的名称。
return | 此配置文件中设置的头 |
getHeaderNames
public String[] getHeaderNames()
- Get the names of the header-fields set in this profile.
- Returns:
- headers set in this profile
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!