Here you can find the source of writeFile(String filePathName, Object obj)
public static void writeFile(String filePathName, Object obj)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void writeFile(String filePathName, Object obj) { ObjectOutputStream oout = null; File file = new File(filePathName); try {/*www. j ava 2 s . com*/ if (!file.exists()) { file.createNewFile(); } oout = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); oout.writeObject(obj); } catch (Exception err) { err.printStackTrace(); } finally { try { oout.close(); } catch (Exception e) { e.printStackTrace(); } } } }