Java tutorial
//package com.java2s; /* * Copyright (C) 2010-2014 Andreas Maier * CONRAD is developed as an Open Source project under the GNU General Public License (GPL). */ import java.beans.XMLDecoder; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; public class Main { public static Object deserializeObject(File file) { Object data = null; try { FileInputStream os = new FileInputStream(file); XMLDecoder decoder = new XMLDecoder(os); data = decoder.readObject(); decoder.close(); } catch (FileNotFoundException f) { data = null; f.printStackTrace(); } return data; } }