简体   繁体   中英

How to perform Binary Search Operation of a text file in memory using java?

How can we perform binary search operation on a text file in java after loading it into the memory ? I ve tried using RandomAccessFile but it takes a lot of time as it does'nt load the file into memory. Is there any other alternative to this ? My file size is 30 MB

You can map the file into memory using MappedByteBuffer.

See here: https://www.codeproject.com/tips/683614/things-to-know-about-memory-mapped-file-in-java

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