I have a very big file (might be even 1G) that I want to create a new file from in a reversed order (in Java). For example:
Original file:
This is the first line
This is the 2nd line
This is the 3rd line
The reversed file:
This is the 3rd line
This is the 2nd line
This is the first line
Since the file is very big, loading the entire file to memory at once and reversing the order there might be problematic (there is a limit to the memory I can use). How can I achieve this in Java?
Thanks