Java tutorial
//package com.java2s; import java.beans.XMLDecoder; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static Object objectXmlDecoder(String objSource) { Object obj = null; try { File fin = new File(objSource); if (fin.exists()) { FileInputStream fis = new FileInputStream(fin); XMLDecoder decoder = new XMLDecoder(fis); obj = decoder.readObject(); fis.close(); decoder.close(); } } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } catch (Exception e1) { e1.printStackTrace(); } return obj; } }