Here you can find the source of serialize(Object obj, String fileName)
public static void serialize(Object obj, String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/*from ww w . j ava 2s .co m*/ * serialize the given object and save it to given file */ public static void serialize(Object obj, String fileName) throws IOException { FileOutputStream fos = new FileOutputStream(fileName); BufferedOutputStream bos = new BufferedOutputStream(fos); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(obj); oos.close(); } }