Class TextFileSearchHandler

    • Constructor Detail

      • TextFileSearchHandler

        public TextFileSearchHandler()
    • Method Detail

      • handles

        public boolean handles​(String file)
        Checks whether the handler can manage this file.
        Specified by:
        handles in interface FileSearchHandler
        Parameters:
        file - the file to check
        Returns:
        true if handler can search this type of file
      • searchFile

        public boolean searchFile​(String file,
                                  String searchText,
                                  boolean caseSensitive,
                                  ExceptionHandler handler)
        Searches the specified file.
        Specified by:
        searchFile in interface FileSearchHandler
        Parameters:
        file - the file to search
        searchText - the search text
        handler - for handling exceptions, can be null
        Returns:
        true if the search text was found
      • searchRegExp

        public boolean searchRegExp​(String file,
                                    String searchText,
                                    boolean caseSensitive,
                                    ExceptionHandler handler)
        Searches the specified file using regular expressions.
        Specified by:
        searchRegExp in interface RegExpFileSearchHandler
        Parameters:
        file - the file to search
        searchText - the search text
        handler - for handling exceptions, can be null
        Returns:
        true if the search text was found
      • searchStream

        public boolean searchStream​(Reader reader,
                                    String searchText,
                                    boolean caseSensitive,
                                    ExceptionHandler handler)
        Searches the specified character stream.
        Specified by:
        searchStream in interface StreamableFileSearchHandler
        Parameters:
        reader - the reader to search
        searchText - the search text
        handler - for handling exceptions, can be null
        Returns:
        true if the search text was found