Here you can find the source of saveSerialized(Serializable obj, File file)
static public void saveSerialized(Serializable obj, File file) throws IOException
//package com.java2s; import java.io.*; public class Main { static public void saveSerialized(Serializable obj, File file) throws IOException { ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); out.writeObject(obj);/*from ww w . j a v a 2 s.com*/ out.close(); } }