Complexity of searhing in binary files
807605Aug 10 2007 — edited Aug 10 2007Hello!
I have question regarding complexity when searching in a binary file. I have a app that needs to perform a search for a certain string in a large binary file (> 1Gb). For the moment, I read one line of the file into a byte array, convert it to a string and than look for any matches with indexOf. This, however, is (yeah, you guessed right..) an extremly slow search algorithm. By the time I wrote it was a good option, but now I am thinking of re-making it.
So my question, is it any idea to try something else? Will it be faster? Is it even possible? Can one use regexp in binary files? A bit confused in this matter...
All ideas are welcome!