I have a GMF file. Its last 9 lines are to be considered as footer. The fast line of footer Starts with "Footer" and last line Ends with "End of file".
So far I have written this
while ((sCurrentLine = br.readLine()) != null ) {
                    if(headcount<11)
                    {
                        HeaderArray.add(sCurrentLine);
                        headcount++;
                        System.out.println("Header["+headcount+"]");
                        System.out.println("sCurrentLine"+sCurrentLine);
                    }
                    else if( headcount>10 &&(sCurrentLine.startsWith("Rerate"))) {
                                RecordsArray.add(sCurrentLine);
                                headcount++;
                                System.out.println("Records");
                                System.out.println("Record"+sCurrentLine);
                    }
                    else if(sCurrentLine.startsWith("Footer"))
                    {   
                            while(footerFlag!="End_of_file:")
                            {
                                FooterArray.add(sCurrentLine);
                                footerFlag=br.readLine();
                                sCurrentLine=footerFlag;
                                System.out.println("Footer");
                                System.out.println("Footer"+sCurrentLine);
                            }
                    }
            }
But this code only goes into an infinite loop. I need all 9 lines of footers in FooterArray. Please help.
 
     
    