Here you can find the source of saveInSerFile(String filename, T object)
public static <T> void saveInSerFile(String filename, T object) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static <T> void saveInSerFile(String filename, T object) throws FileNotFoundException, IOException { ObjectOutputStream output = new ObjectOutputStream( new FileOutputStream(new File(filename))); try {/*from w w w.jav a 2 s. c o m*/ output.writeObject(object); } finally { output.close(); } } }