Here you can find the source of deserialize(Class
public static <T extends Serializable> T deserialize(Class<T> clazz, File file) throws FileNotFoundException, IOException, ClassNotFoundException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; public class Main { public static <T extends Serializable> T deserialize(Class<T> clazz, File file) throws FileNotFoundException, IOException, ClassNotFoundException { ObjectInputStream ois = null; try {//from ww w . j a v a 2s .com ois = new ObjectInputStream(new FileInputStream(file)); return (T) ois.readObject(); } finally { if (ois != null) { ois.close(); } } } }