Class MessageMatcher
- java.lang.Object
-
- org.apache.james.mime4j.utils.search.MessageMatcher
-
public class MessageMatcher extends java.lang.Object
Searches an email for content.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageMatcher.MessageMatcherBuilder
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
contentTypes
private boolean
ignoringMime
private boolean
includeHeaders
private boolean
isCaseInsensitive
private org.slf4j.Logger
logger
private java.util.List<java.lang.CharSequence>
searchContents
-
Constructor Summary
Constructors Modifier Constructor Description private
MessageMatcher(java.util.List<java.lang.CharSequence> searchContents, boolean isCaseInsensitive, boolean includeHeaders, boolean ignoringMime, java.util.List<java.lang.String> contentTypes, org.slf4j.Logger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MessageMatcher.MessageMatcherBuilder
builder()
private boolean
checkBody(java.nio.CharBuffer buffer, MimeTokenStream parser)
private boolean
checkHeader(java.nio.CharBuffer buffer, MimeTokenStream parser)
private char
computeNextChar(boolean isCaseInsensitive, char read)
private java.nio.CharBuffer
createBuffer(java.lang.CharSequence searchContent)
protected void
handle(java.lang.Exception e)
boolean
isFoundIn(java.io.Reader reader, java.nio.CharBuffer buffer)
private boolean
matchBufferInMailBeingMimeAware(java.io.InputStream input, java.nio.CharBuffer buffer)
private boolean
matches(java.nio.CharBuffer buffer, char next)
boolean
messageMatches(java.io.InputStream input)
Is searchContents found in the given input?
-
-
-
Field Detail
-
logger
private final org.slf4j.Logger logger
-
searchContents
private final java.util.List<java.lang.CharSequence> searchContents
-
contentTypes
private final java.util.List<java.lang.String> contentTypes
-
isCaseInsensitive
private final boolean isCaseInsensitive
-
includeHeaders
private final boolean includeHeaders
-
ignoringMime
private final boolean ignoringMime
-
-
Method Detail
-
builder
public static MessageMatcher.MessageMatcherBuilder builder()
-
messageMatches
public boolean messageMatches(java.io.InputStream input) throws java.io.IOException, MimeException
Is searchContents found in the given input?- Parameters:
input
-InputStream
containing an email- Returns:
- true if the content exists and the stream contains the content, false otherwise. It takes the mime structure into account.
- Throws:
java.io.IOException
MimeException
-
matchBufferInMailBeingMimeAware
private boolean matchBufferInMailBeingMimeAware(java.io.InputStream input, java.nio.CharBuffer buffer) throws java.io.IOException, MimeException
- Throws:
java.io.IOException
MimeException
-
checkHeader
private boolean checkHeader(java.nio.CharBuffer buffer, MimeTokenStream parser) throws java.io.IOException
- Throws:
java.io.IOException
-
checkBody
private boolean checkBody(java.nio.CharBuffer buffer, MimeTokenStream parser) throws java.io.IOException
- Throws:
java.io.IOException
-
createBuffer
private java.nio.CharBuffer createBuffer(java.lang.CharSequence searchContent)
-
handle
protected void handle(java.lang.Exception e) throws java.io.IOException, MimeException
- Throws:
java.io.IOException
MimeException
-
isFoundIn
public boolean isFoundIn(java.io.Reader reader, java.nio.CharBuffer buffer) throws java.io.IOException
- Throws:
java.io.IOException
-
computeNextChar
private char computeNextChar(boolean isCaseInsensitive, char read)
-
matches
private boolean matches(java.nio.CharBuffer buffer, char next)
-
-