Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

search & replace in binary file

Thread view: 
Ike - 27 Nov 2006 11:01 GMT
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
Tony Dahlman - 30 Nov 2006 04:02 GMT
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.