Read large amount of data from file in Java

后端 未结 7 1345
一生所求
一生所求 2020-12-03 01:36

I\'ve got text file that contains 1 000 002 numbers in following formation:

123 456
1 2 3 4 5 6 .... 999999 100000

Now I need

7条回答
  •  不知归路
    2020-12-03 02:08

    How much memory do you have in the computer? You could be running into GC issues.

    The best thing to do is to process the data one line at a time if possible. Don't load it into an array. Load what you need, process, write it out, and continue.

    This will reduce your memory footprint and still use the same amount of File IO

提交回复
热议问题