简体   繁体   中英

When using RandomAccessFile and Multi Thread, How do I split big char file?

I have to read a big char file.Then I have found RandomAccessFile which meets my need. I have a try, then faced with a question that how to get the point that every thread starts with.

The RandomAccessFile API read file by byte, but the file is charset and I need to process every line.so How do I spilt it by line ?

thanks help.

Can not do this with NIO.

I have to read a big char file.

So you should be using FileReader , probably wrapped in a BufferedReader .

However reading a file with multiple threads won't buy you anything. The disk isn't multi-threaded.

And you can't read lines in parallel. It doesn't even make sense,

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