Here you can find the source of saveData(Object data, String filename)
public static boolean saveData(Object data, String filename)
//package com.java2s; //License from project: Open Source License import java.io.FileOutputStream; import java.io.ObjectOutputStream; public class Main { public static boolean saveData(Object data, String filename) { try {//from w w w .ja v a 2 s . c om FileOutputStream fo = new FileOutputStream(filename); ObjectOutputStream oo = new ObjectOutputStream(fo); oo.writeObject(data); oo.close(); fo.close(); } catch (Exception e) { return false; } return true; } }