Here you can find the source of serialize(Object object, String path)
public static void serialize(Object object, String path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void serialize(Object object, String path) throws IOException { FileOutputStream fout = new FileOutputStream(path); ObjectOutputStream out = new ObjectOutputStream(fout); out.writeObject(object);//ww w. ja v a 2 s. c o m out.close(); fout.close(); } }