Class AhoCorasick<T>
java.lang.Object
org.apache.nifi.util.search.ahocorasick.AhoCorasick<T>
- All Implemented Interfaces:
Search<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate NodeaddMatch(SearchTerm<T> term, int offset, Node current) private voidvoidinitializeDictionary(Set<SearchTerm<T>> terms) Establishes the dictionary of terms which will be searched in subsequent search calls.search(InputStream stream, boolean findAll) Searches the given input stream for matches between the already specified dictionary and the contents scanned.private SearchStatesearch(InputStream stream, boolean findAll, SearchState state)
-
Field Details
-
root
-
-
Constructor Details
-
AhoCorasick
public AhoCorasick()
-
-
Method Details
-
initializeDictionary
Description copied from interface:SearchEstablishes the dictionary of terms which will be searched in subsequent search calls. This can be called only once- Specified by:
initializeDictionaryin interfaceSearch<T>- Parameters:
terms- the terms to create a dictionary of
-
addMatch
-
initialize
private void initialize() -
search
Description copied from interface:SearchSearches the given input stream for matches between the already specified dictionary and the contents scanned.- Specified by:
searchin interfaceSearch<T>- Parameters:
stream- the source data to scan for hitsfindAll- if true will find all matches if false will find only the first match- Returns:
- SearchState containing results Map might be empty which indicates no matches found but will not be null
- Throws:
IOException- Thrown for any exceptions occurring while searching.
-
search
private SearchState search(InputStream stream, boolean findAll, SearchState state) throws IOException - Throws:
IOException
-