Interface Search<T>

All Known Implementing Classes:
AhoCorasick

public interface Search<T>
Defines an interface to search for content given a set of search terms. Any implementation of search must be thread safe.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Establishes the dictionary of terms which will be searched in subsequent search calls.
    search(InputStream haystack, boolean findAll)
    Searches the given input stream for matches between the already specified dictionary and the contents scanned.
  • Method Details

    • initializeDictionary

      void initializeDictionary(Set<SearchTerm<T>> terms)
      Establishes the dictionary of terms which will be searched in subsequent search calls. This can be called only once
      Parameters:
      terms - the terms to create a dictionary of
    • search

      SearchState<T> search(InputStream haystack, boolean findAll) throws IOException
      Searches the given input stream for matches between the already specified dictionary and the contents scanned.
      Parameters:
      haystack - the source data to scan for hits
      findAll - 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.
      IllegalStateException - if the dictionary has not yet been initialized