Class FileContentSearch

java.lang.Object
org.owasp.dependencycheck.utils.search.FileContentSearch

public final class FileContentSearch extends Object
Utility for searching files.
Version:
$Id: $Id
Author:
Jeremy Long
  • Method Details

    • contains

      public static boolean contains(File file, String pattern) throws IOException
      Determines if the given file contains the given regular expression.
      Parameters:
      file - the file to test
      pattern - the pattern used to test the file
      Returns:
      true if the regular expression matches the file content; otherwise false
      Throws:
      IOException - thrown if there is an error reading the file
    • contains

      public static boolean contains(File file, String[] patterns) throws IOException
      Determines if the given file contains the given regular expressions.
      Parameters:
      file - the file to test
      patterns - the array of patterns used to test the file
      Returns:
      true if one of the regular expressions matches the file content; otherwise false
      Throws:
      IOException - thrown if there is an error reading the file