Java tutorial
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.ObjectInputStream; public class Main { public static Object readFileByObject(String fileName) { try { FileInputStream fis = new FileInputStream(fileName); ObjectInputStream ois = new ObjectInputStream(fis); Object o = ois.readObject(); ois.close(); fis.close(); return o; } catch (Exception e) { return null; } } }