Writing Data or Objects?
Let's see, well I got a problem
I have a program that saves objects with user data, however i think this is not the best idea because if the class changed then the object will not work and there will be crappy stuff around
So i think it is better to write Data instead of Objects, my next problem is...
how do I read data again to an object?
Like I want to add "Name, Address, Birthday, Account, Password"
then i need
but supposing i make a registry of 100 or 1000, lets say p people
how do i read the data of say the person number n? (say, n=834)
Supossing the user 834 changes his password, how am I supposed to save the changes on the file?
I have found readLine() to be the only effective solution, one day I will go to writing binary which can be read in with DataInputStream, but for now I just do ( instinctively )
String buffer = datafile.readLine();
if(buffer != null)
which works if you get the right java.io filetype...
Ok, I guess.
I thought that perhaps i should write the acc first then the password, so when i look for the acc i save it, then i look for the password if it doesnt match, returns false on either case, if it does, it returns true and a new object is created or something similar
But, how do i save changes when the user does something?