Here you can find the source of loadSerialized(File file)
static public Serializable loadSerialized(File file) throws IOException
//package com.java2s; import java.io.*; public class Main { static public Serializable loadSerialized(File file) throws IOException { try {/*from www . java2 s . co m*/ return loadSerialized(new FileInputStream(file)); /*ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file))); Object obj = in.readObject(); in.close(); return (Serializable)obj; */ } catch (IllegalArgumentException e) { throw new IllegalArgumentException("can't read serialized object from " + file + ": " + e); } } public static Serializable loadSerialized(InputStream input) throws IOException { try { ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(input)); Object obj = in.readObject(); in.close(); return (Serializable) obj; } catch (ClassNotFoundException e) { throw new IllegalArgumentException("can't read serialized object from " + input + ": " + e); } } }