Java tutorial
//package com.java2s; import java.beans.XMLDecoder; import java.io.BufferedInputStream; import java.io.FileInputStream; public class Main { public static Object read(String filename) throws Exception { XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(filename))); Object o = decoder.readObject(); decoder.close(); return o; } }