Results 1 to 3 of 3
Thread: Writing Data or Objects?
- 11-26-2008, 01:07 AM #1
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?
Last edited by Goodwine; 11-26-2008 at 01:29 AM. Reason: TypoSi vis pasem para bellum
- 11-26-2008, 01:23 AM #2
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...Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 11-26-2008, 01:36 AM #3
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?Si vis pasem para bellum
- By abhishek.jain in forum New To JavaReplies: 4Last Post: 01-29-2009, 09:12 AM
- By kirtesh4u in forum New To JavaReplies: 5Last Post: 11-15-2008, 05:10 PM
- By dele in forum Java SoftwareReplies: 0Last Post: 10-31-2008, 03:13 PM
- By stutiger99 in forum New To JavaReplies: 2Last Post: 10-08-2008, 03:52 AM
- By kevinsong in forum Advanced JavaReplies: 16Last Post: 07-16-2008, 06:59 PM