开发者

How to read several lines from text file into memory?

开发者 https://www.devze.com 2022-12-23 02:50 出处:网络
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 torepresent 10MB, in

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消