当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How to read several lines from text file into memory?

问题描述:

I have a file with the structure like so: http://gamedev.pastebin.com/8iESYTVY

but it's much bigger in size, 233MB, how can I read blocks of lines, enough lines to represent 10MB, into memory so I won't have to read in the whole file?

网友答案:

You could use Java nio, which allow random access to a file. Or, in other words, allows mapping a file to memory, allowing your Java program to access it permanently at random locations.

分享给朋友:
您可能感兴趣的文章:
随机阅读: