开发者

Most efficient way to read files in Java?

开发者 https://www.devze.com 2023-01-13 06:42 出处:网络
As most 开发者_开发问答other people, I deal with file I/O a lot and I wanted to make sure that I wasn\'t losing time on reading the file. I currently know of FileReader() as the most efficient way to

As most 开发者_开发问答other people, I deal with file I/O a lot and I wanted to make sure that I wasn't losing time on reading the file. I currently know of FileReader() as the most efficient way to read files in Java, but I was hoping there would be something obscure that was better.

Also, can you skip reading a line in a file in Java/C?


Who said FileReader is the most efficient? It isn't. Wrap a BufferedReader around it and you will get a surprise. If the file is binary you shouldn't be using a reader at all, and if efficiency is a major concern maybe you shouldn't even be using a file.

0

精彩评论

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