Here you can find the source of saveObject(File file, Object o, boolean overwrite)
public static synchronized void saveObject(File file, Object o, boolean overwrite) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static synchronized void saveObject(File file, Object o, boolean overwrite) throws IOException { ObjectOutputStream oos = null; if (file.exists() && !overwrite) { throw new IOException("file exists: " + file.getCanonicalPath()); }/* w w w . j ava2 s .c o m*/ try { oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(o); } finally { if (oos != null) { oos.close(); } } } }