I have a binary file with the following format:
[N bytes identifier & record length] [n1 bytes data] [N bytes identifier & record length] [n2 bytes data] [N bytes identifier & record length] [n3 bytes data]
As you can see, I have records of different lengths. in each record, I have N bytes that contain both id and data length in the record .
this file is very large and can contain 3 million records.
I want to open this file with an application and allow the user to view and edit entries. (Insert / Update / Delete Entries)
my initial plan is to create and index the file from the source file and for each record, save the next and previous record address to easily move back and forth. (some sort of linked list, but not in memory in the file)
----------------- EDIT ----------------------------- --- --------------
Thanks for the tips and tricks,
Additional Information:
the source file and its format are beyond my control (this is a third-party file), and I cannot change the file format. but I have to read it, let the user navigate through the records and edit some of them (insert a new record / update an existing record / delete the record), and at the end save it back to the original file format .
do u still recommend DataBase instead of regular index file?
----------------- SECOND EDITING ---------------------------- --- ---------------
Record size in update mode is fixed. this means that the updated (edited) record has the same length as the original record, unless the user deletes the record and creates another record in a different format.
Many thanks
java file-io binaryfiles
mhshams
source share