title: How to read last line of a 1GB file - java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/686231/java-quickly-read-the-last-line-of-a-text-file">Java: Quickly read the last line of a text file?</a>  </p>
  </blockquote>
  
  
  
  <p>Our mainframes system is sending a file which has header , detail records and a trailer.
  I want to persist these details records in to my database only if</p>
  
  <ol>
  <li>The file is a valid file - meaning one with valid header, detailed record and trailer.</li>
  <li>The number of detailed records count is equal to count in trailer record.</li>
  </ol>
  
  <p>My goal is to read the last line first without reading the entire 1GB file.</p>
  
  <pre><code>AAGSDBGBBM337 2012-03-16165620000001 - Header format
  Detailed Record 1
  Detailed Record 2
  Detailed Record 3
  ZZGSDBGBBM337 2012-03-161656200000010000003 - Trailer format
  </code></pre>
  
  <p>Any suggestions ?</p>