Possible Duplicate:
Java: Quickly read the last line of a text file?
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
- The file is a valid file - meaning one with valid header, detailed record and trailer.
- The number of detailed records count is equal to count in trailer record.
My goal is to read the last line first without reading the entire 1GB file.
AAGSDBGBBM337 2012-03-16165620000001 - Header format
Detailed Record 1
Detailed Record 2
Detailed Record 3
ZZGSDBGBBM337 2012-03-161656200000010000003 - Trailer format
Any suggestions ?