Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Complexity of searhing in binary files

807605Aug 10 2007 — edited Aug 10 2007
Hello!

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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2007
Added on Aug 10 2007
7 comments
282 views