java - how do you write arraylist to a binary file -
how write arraylist binary file?
lets have arraylist called people
i trying write binary file using writelisttobinary method
my method:
public void writelisttobinary (arraylist<person> inlist) throws ioexception
in main method:
arraylist<person> people = new arraylist<person>(); writelisttobinary(people);
i think trying serialize arraylist
. implement serializable
class, then:
fileoutputstream fos = new fileoutputstream(filetosaveto); objectoutputstream out = new objectoutputstream(fos); out.writeobject(people)
also take @ http://www.tutorialspoint.com/java/java_serialization.htm
Comments
Post a Comment