Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; public class Main { public static <T> T deserializeObjectFromFile(FileInputStream input) { try { ObjectInputStream deserializer = new ObjectInputStream(input); return (T) deserializer.readObject(); } catch (IOException e) { e.printStackTrace(); return null; } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } } }