Class FileContentSearch


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean contains​(java.io.File file, java.lang.String pattern)
      Determines if the given file contains the given regular expression.
      static boolean contains​(java.io.File file, java.lang.String[] patterns)
      Determines if the given file contains the given regular expressions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • contains

        public static boolean contains​(java.io.File file,
                                       java.lang.String pattern)
                                throws java.io.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:
        java.io.IOException - thrown if there is an error reading the file
      • contains

        public static boolean contains​(java.io.File file,
                                       java.lang.String[] patterns)
                                throws java.io.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:
        java.io.IOException - thrown if there is an error reading the file