Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > search & replace in binary file

Reply
Thread Tools

search & replace in binary file

 
 
Ike
Guest
Posts: n/a
 
      11-27-2006
I have a binary file which I must rewrite out to the local disk. In the
process of doing that, there are some 30 character strings I must search and
replace with a different corresponding string to each of those 30 character
strings. Each of these strings is between 10 and 500 bytes long.

Can someone please tell me what htey think the most efficient and effective
way to do this might be? TIA, Ike


 
Reply With Quote
 
 
 
 
Tony Dahlman
Guest
Posts: n/a
 
      11-30-2006
Ike at a hotmail address wrote:
> I have a binary file which I must rewrite out to the local disk. In the
> process of doing that, there are some 30 character strings I must search

and
> replace with a different corresponding string to each of those 30

character
> strings. Each of these strings is between 10 and 500 bytes long.


> Can someone please tell me what htey think the most efficient and

effective
> way to do this might be? TIA, Ike


Hey Ike! I guess all files are binary, or hex or octal, or something,
aren't
they? Worse yet, the characters could be any language -- did you think of
that?

Anyway, you might want to read in at least 500 bytes at a time, into a
buffer
of at least 1,000 bytes. Then you search and replace as needed. The only
problem I see is if the "local disk" is full and you can't write your
results until you've deleted the previously read portions of the file.

By the way, how are you doing on this? Do you have any code that you
could
share with the folks here? Knowing whether your problem is I/O, i18n, or
proprietary/encoded data, or something else might help readers of the
newsgroup to help you.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary tree search vs Binary search Bogdan C Programming 22 10-21-2010 09:46 PM
beginner with C : quick search or binary search help needed with forand while bpascal123@googlemail.com C Programming 9 07-03-2009 08:00 PM
Help understand probems - Binary Search and Sequenital Search Timmy C++ 5 07-09-2007 02:41 PM
search and replace in a binary file Rafal Konopka Perl Misc 6 07-23-2006 10:44 AM
Binary Search to search linearizer table? Andy C Programming 1 11-25-2003 04:40 AM



Advertisments