I am currently trying to find the fastest way to find a 2GB binary in java. This is different from my usual problems, as this file is already displayed on the Linux file system with mmap.
The question is a binary, and I need to find it for a fixed four-byte string; AXL0
Usually, in small files, I simply buffer it, convert it to a string, and then re-express it. However, since this file is already mapped onto the card and quite large, the idea of ββre-buffering seems wrong, and converting it to a 2 GB line seems even more erroneous ...
After some reading, I came across Java packages NIOalong with FileChannelsand MappedByteBuffers, but I'm not quite sure how to configure them.
I just need to scan the file, from zero to the last byte in the file, and find each instance of the four byte lines.
If anyone could offer any advice or input, I would really appreciate it.
Thank.
source
share