Class MessageMatcher
- java.lang.Object
-
- org.apache.james.mime4j.utils.search.MessageMatcher
-
public class MessageMatcher extends java.lang.ObjectSearches an email for content.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMessageMatcher.MessageMatcherBuilder
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>contentTypesprivate booleanignoringMimeprivate booleanincludeHeadersprivate booleanisCaseInsensitiveprivate org.slf4j.Loggerloggerprivate java.util.List<java.lang.CharSequence>searchContents
-
Constructor Summary
Constructors Modifier Constructor Description privateMessageMatcher(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.MessageMatcherBuilderbuilder()private booleancheckBody(java.nio.CharBuffer buffer, MimeTokenStream parser)private booleancheckHeader(java.nio.CharBuffer buffer, MimeTokenStream parser)private charcomputeNextChar(boolean isCaseInsensitive, char read)private java.nio.CharBuffercreateBuffer(java.lang.CharSequence searchContent)protected voidhandle(java.lang.Exception e)booleanisFoundIn(java.io.Reader reader, java.nio.CharBuffer buffer)private booleanmatchBufferInMailBeingMimeAware(java.io.InputStream input, java.nio.CharBuffer buffer)private booleanmatches(java.nio.CharBuffer buffer, char next)booleanmessageMatches(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, MimeExceptionIs searchContents found in the given input?- Parameters:
input-InputStreamcontaining 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.IOExceptionMimeException
-
matchBufferInMailBeingMimeAware
private boolean matchBufferInMailBeingMimeAware(java.io.InputStream input, java.nio.CharBuffer buffer) throws java.io.IOException, MimeException- Throws:
java.io.IOExceptionMimeException
-
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.IOExceptionMimeException
-
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)
-
-