Java tutorial
//package com.java2s; import java.beans.XMLDecoder; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static Object deserializeObjectFromFile(final String filePath) throws FileNotFoundException, IOException, ClassNotFoundException { try (FileInputStream file = new FileInputStream(filePath); BufferedInputStream buffer = new BufferedInputStream(file); XMLDecoder input = new XMLDecoder(buffer);) { return input.readObject(); } } }