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

Popular posts from this blog

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

java - Reading data from multiple zip files and combining them to one -