我有一个非常大的文件(甚至可能是1G),我想以相反的顺序(在Java中)创建一个新文件.例如:
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
Run Code Online (Sandbox Code Playgroud)
由于文件非常大,一次将整个文件加载到内存并反转顺序可能会有问题(我可以使用的内存有限).我怎样才能在Java中实现这一目标?
谢谢
| 归档时间: |
|
| 查看次数: |
3597 次 |
| 最近记录: |