Here you can find the source of serialize(final String path, final Object object)
Convenience method for serializing an object into a file.
public static void serialize(final String path, final Object object) throws IOException
//package com.java2s; import java.io.*; public class Main { /**//from ww w .jav a 2 s. co m * <p>Convenience method for serializing an object into a file.</p> */ public static void serialize(final String path, final Object object) throws IOException { final ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(path)); stream.writeObject(object); stream.close(); } }