I am using textfiles a database to store data for a travel agent and have ran into a problem with updating the textfile with out replace the entire data in the file. I am using StringTokenizer to read and place the relevant data in the correct textField so heres the problem if I try to update a field the entry select is updated and the other entries are deleted. Heres part of my code:
I think there are ways to open a file for appending, and maybe using Random Access File you can remove / change certain parts of the file. But honestly these days file data throughput is very very high (certainly 100s of megabytes / sec, maybe gigabytes / sec), but file latency (the time it takes for the HD to get to the right sector) is the key performance stopper. So writing the whole file to disk again doesn't cost you anything. I rewrite the whole file with all of my changing files.