Here you can find the source of serializeObject(Object object, File f)
public static void serializeObject(Object object, File f) throws IOException
//package com.java2s; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.OutputStream; public class Main { public static void serializeObject(Object object, File f) throws IOException { //use buffering OutputStream file = new FileOutputStream(f); OutputStream buffer = new BufferedOutputStream(file); ObjectOutput output = new ObjectOutputStream(buffer); output.writeObject(object);//from w ww .j ava 2s. co m output.close(); } }