4

I'm trying to read a fixed-width flat file with JRecordBind. Each line can be a subrecord of the previous one and the first line and the last one are header and footer of root record.

Example:

xxxxxxxxxxxxx -> Record1 header with list of Records2
yyyyyyyyyyy1h -> Record2 instance 1header with list of Records3
@@@@@@@@@@@@1 -> Record3 instance1
@@@@@@@@@@@@2 -> Record3 instance2
yyyyyyyyyyy1f -> Record2 footer
yyyyyyyyyyy2h
@@@@@@@@@@@@3
@@@@@@@@@@@@4
yyyyyyyyyyy2f
zzzzzzz   

My problem is the size of the file with many records (in my case 140,000), a StackOverFlow exception is thrown.

I'm analyzing BeanIO as an alternative to JRecordBind.

What is the best option with these kind of files?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
mordis84
  • 41
  • 3
  • I would read the lines to a LIst with commons IO and write a function to parse each line. – bhspencer Sep 01 '15 at 14:07
  • 1
    What ever library you use, I would suggest processing one record at a time; that will scale much better. 140,000 is not a big file. – Bruce Martin Sep 02 '15 at 08:00

0 Answers0