Example usage for javax.mail.search SearchTerm match

List of usage examples for javax.mail.search SearchTerm match

Introduction

In this page you can find the example usage for javax.mail.search SearchTerm match.

Prototype


public abstract boolean match(Message msg);

Source Link

Document

This method applies a specific match criterion to the given message and returns the result.

Usage

From source file:org.alfresco.repo.imap.AlfrescoImapFolder.java

@Override
protected long[] searchInternal(SearchTerm searchTerm) {
    List<SimpleStoredMessage> messages = getMessages();
    long[] result = new long[messages.size()];
    int i = 0;/*from   w w  w  .j a  v  a2s. com*/

    for (SimpleStoredMessage message : messages) {
        if (searchTerm.match(message.getMimeMessage())) {
            result[i] = message.getUid();
            i++;
        }
    }
    return Arrays.copyOfRange(result, 0, i);
}