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