本文整理汇总了Java中javax.mail.search.SearchTerm.match方法的典型用法代码示例。如果您正苦于以下问题:Java SearchTerm.match方法的具体用法?Java SearchTerm.match怎么用?Java SearchTerm.match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.mail.search.SearchTerm
的用法示例。
在下文中一共展示了SearchTerm.match方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchInternal
import javax.mail.search.SearchTerm; //导入方法依赖的package包/类
@Override
protected long[] searchInternal(SearchTerm searchTerm)
{
List<SimpleStoredMessage> messages = getMessages();
long[] result = new long[messages.size()];
int i = 0;
for (SimpleStoredMessage message : messages)
{
if (searchTerm.match(message.getMimeMessage()))
{
result[i] = message.getUid();
i++;
}
}
return Arrays.copyOfRange(result, 0, i);
}
示例2: search
import javax.mail.search.SearchTerm; //导入方法依赖的package包/类
public long[] search(SearchTerm searchTerm) {
ArrayList matchedMessages = new ArrayList();
for (int i = 0; i < mailMessages.size(); i++) {
SimpleStoredMessage message = (SimpleStoredMessage) mailMessages.get(i);
if (searchTerm.match(message.getMimeMessage())) {
matchedMessages.add(message);
}
}
long[] matchedUids = new long[matchedMessages.size()];
for (int i = 0; i < matchedUids.length; i++) {
SimpleStoredMessage storedMessage = (SimpleStoredMessage) matchedMessages.get(i);
long uid = storedMessage.getUid();
matchedUids[i] = uid;
}
return matchedUids;
}
示例3: search
import javax.mail.search.SearchTerm; //导入方法依赖的package包/类
public Message[] search(final SearchTerm term, final Message[] msgsToSearch) {
final List<MockMessage> sms = new ArrayList<MockMessage>();
final List<Message> msgsToSearchL = new ArrayList<Message>();
if (msgsToSearch != null) {
msgsToSearchL.addAll(Arrays.asList(msgsToSearch));
}
for (final Message msg : getMessages()) {
if (term != null && term.match(msg)) {
if (msgsToSearch == null || msgsToSearchL.contains(msg)) {
sms.add((MockMessage) msg);
}
}
}
return sms.toArray(new Message[sms.size()]);
}
示例4: search
import javax.mail.search.SearchTerm; //导入方法依赖的package包/类
@Override
public long[] search(SearchTerm searchTerm) {
List<StoredMessage> matchedMessages = new ArrayList<>();
synchronized (mailMessages) {
for (int i = 0; i<mailMessages.size();i++) {
StoredMessage mailMessage = mailMessages.get(i);
// Update message sequence number for potential sequence set search
// https://tools.ietf.org/html/rfc3501#page-10
mailMessage.updateMessageNumber(i+1);
if (searchTerm.match(mailMessage.getMimeMessage())) {
matchedMessages.add(mailMessage);
}
}
}
long[] matchedUids = new long[matchedMessages.size()];
for (int i = 0; i < matchedUids.length; i++) {
StoredMessage storedMessage = matchedMessages.get(i);
long uid = storedMessage.getUid();
matchedUids[i] = uid;
}
return matchedUids;
}