简体   繁体   中英

Most efficient way to read files in Java?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM