Help with I/O
Hi everyone, i'm new here, and ill'd apreciate a little help on this job i have.
i need to write objects on a file and read them and insert in a binary search tree.
The problem is: i don't know how to do this in a way that i can read them with no problems, i don't know how to write the object each in a single line.
Little help please!
Have you seen this?
http://java.sun.com/docs/books/tutorial/essential/io/index.html
Which part are you having trouble with?
What format do you want the file to have? Text? Binary data that doesn't represent text?
If you post code, look above the message box for the code button, and use it to add code tags so that your code is readable.
thanx for the help, I'm lookin'up on the tutorial now.i'm having trouble in readin the objects, the thing is that i have to write 20 objects to a text file, and read them back to a binary tree.i'm having trouble reading them, i don't know how to do it.
The reply above will direct you to two classes - ObjectInputStream and ObjectOutputStream.
The output class has a method called writeObject() and the input class has a method called readObject().
The output will convert your object to a serial stream while preserving the object's "state" in such a way as to allow the input to restore that object's "state".
Hope that helps.