Here you can find the source of writeFile(String filename, Object object)
public static void writeFile(String filename, Object object)
//package com.java2s; //License from project: Apache License import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static void writeFile(String filename, Object object) { try {//from ww w. j a v a 2 s.c om FileOutputStream fout = new FileOutputStream(filename); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(object); oos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }