Here you can find the source of serialize(final Object object, final File file)
public static void serialize(final Object object, final File file)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static void serialize(final Object object, final File file) { try {/* w ww. j ava2s .com*/ final FileOutputStream fileOut = new FileOutputStream(file); final ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(object); out.close(); fileOut.close(); } catch (final IOException e) { throw new RuntimeException(e); } } }