compression - How to do Binary Search over memory mapped compressed file in java? -


i have problem, rather close binary search in sorted (memory-mapped ?) file in java

i want implement binary search string in large file java mappedbytebuffers in case, large file compressed bzip2. let's file compressed -1 option 100k block. (actually don't know exact options can repak file).

how should search strings in such mappedbytebuffer? how decompress 1 block? there standart lib or should read header, deflate section , crc? , block 100k in compressed state, or 100k it's uncompressed data length? , how last block looks like?

have done binarysearch on compressed file, maybe not java?

you need read file index of each block starts. once have can binary search of blocks. note: if have underlying record or key, split across multiple blocks.

a better solution build compressed file yourself. write known number of records block , compress individually. additionally can write index each block starts first key block. allow find right block without decompressing keys , decompress 1 block instead of log2(n) blocks per search.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -