Java tutorial
//package com.java2s; //License from project: Open Source License import java.beans.XMLDecoder; import java.io.*; public class Main { /** * Deserializes an object into from xml file * * @param fileName path to ffile */ public static Object decodeFromFile(String fileName) throws FileNotFoundException, IOException { Object object = null; XMLDecoder decoder = new XMLDecoder(new FileInputStream(fileName)); try { object = decoder.readObject(); } finally { decoder.close(); } return object; } }