title: How to skip lines with ItemReader in Spring-Batch?
body: <p>I have a custom item reader that transforms lines from a textfile to my entity:</p>
  
  <pre><code>public class EntityItemReader extends AbstractItemStreamItemReader&lt;MyEntity&gt; {
      @Override
      public MyEntity read() {
         String line = delegate.read();
         //analyze line and skip by condition
         //line.split
         //create entity with line values
      }
  }
  </code></pre>
  
  <p>This is similar to the <code>FlatFileItemReader</code>.</p>
  
  <p>The read <code>MyEntity</code> will then be persisted to a DB by a <code>JdbcItemReader</code>.</p>
  
  <p>Problem: sometimes I have lines that contain values that should be skipped.</p>
  
  <p>BUT when I just <code>return null</code> inside the <code>read()</code> method of the reader, then not only this item is skipped, by the reading is terminated completely, and all further lines will be skipped. Because a <code>null</code> element is the "signal" for all spring-readers that the file to be read is finished.</p>
  
  <p>So: what can I do to skip specific lines by condition inside the reader if I cannot return null? Because by nature of the reader I'm forced to return an object here.</p>