i have a clients.dat file with client info in it. i have gone through it to find the record i want to delete, used PushBackBuffer to unread the one i want top delete, skipped that bit and carried on reading the rest and writing it to clients.tmp.
after i have gone through the file and written the undeleted ones to clients.tmp, i want to delete the clients.dat and rename clients.tmp to clients.dat. have got everything right, except the deleting bit. i can't delete the original. i even tried deleteOnExit(), but that only works on the .tmp file.
i initially decided to use a class that handles the connections to the file (like i do with my database applications), but decided that for this i'll need to open the file and read/write, then close my streams again, because files are stupid and not as cool as databases.
i know i'm doing something stupid (because recently i've been making a ton of n00b-like errors and things), so i'm asking you guys for help.
i've attached the code for the FileHandler class which does the writing, deleting and updating of records in the file. if it's something REALLY obvious, then please feel free to hurl abuse at me.