Java tutorial
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static Object restore(String fileName) throws IOException, ClassNotFoundException { FileInputStream fis = new FileInputStream(fileName); ObjectInputStream in = new ObjectInputStream(fis); Object obj = in.readObject(); in.close(); return obj; } public static void close(Closeable closable) { if (closable != null) { try { closable.close(); } catch (IOException e) { e.printStackTrace(); } } } }