Reading a Huge Fixed Width file
<p>I Have a requirement to read a <strong>Huge</strong> Flat File, <strong>without keeping the entire file in memory.</strong>
It is flat file with multiple segments, each record starting with a Header record identified by 'H' in the beginning followed by many lines and then again Header record, this pattern repeats
For e.g.</p>

<pre><code>HXYZ CORP  12/12/2016
R1 234 qweewwqewewq wqewe
R1 234 qweewwqewewq wqewe
R1 234 qweewwqewewq wqewe
R2 344 dfgdfgdf gfd  df g
HABC LTD  12/12/2016
R1 234 qweewwqewewq wqewe
R2 344 dfgdfgdf gfd  df g
HDRE CORP  12/12/2016
R1 234 qweewwqewewq wqewe
R2 344 dfgdfgdf gfd  df g
R2 344 dfgdfgdf gfd  df g 
</code></pre>

<p>I want to read a record set at a time for e.g. </p>

<pre><code>HDRE CORP  12/12/2016
R1 234 qweewwqewewq wqewe
R2 344 dfgdfgdf gfd  df g
R2 344 dfgdfgdf gfd  df g 
</code></pre>

<p>How can i achieve this keep in mind that i do not want to keep the entire file in memory
Is there any standard library that i can use for this purpose?
I have tried using some implementations without much success, i have used Apache's Line Iterator , but that reads line by line.</p>

<p>Any help or suggestions will be much appreciated.</p>