title: Reading large files and filter using contains() java
body: <p>I am reading large log files using BufferedReader in java.I have to filter the contents of the file and store the data in database.
  example.</p>
  
  <pre><code>BufferedReader br=new BufferedReader(new FileReader("test.log"));
  String line;
  while((line=br.readLine())!=null){
     if(line.contains("filter1") || line.contains("filter2") ||
         line.contains("filter3") || line.contains("filter4")...){
          //creating object and storing using hibernate
      }
  }
  </code></pre>
  
  <p>I have more than 50 such filters and the problem occurs in reading files over 100 MB. A lot of time is wasted in matching these filter strings.</p>
  
  <p>I cannot use Collection.contains(line) as the filters in if conditions are substrings of the line read. The time taken is not due to IO but the filtering of contents and creating objects for storing.</p>
  
  <p>Edit 1 :- filter1, filter2 are just for simplicity only. In actual cases, the filter would be like - "new file", "report","removed from folder","schema","move","copy","added to queue","unique id" etc. These are the specific keyword that I check to see if the line contains relevant data for storing. </p>
  
  <p>Please suggest a better way for achieving the same.</p>