Java tutorial
//package com.java2s; //License from project: LGPL import java.beans.XMLDecoder; import java.io.InputStream; public class Main { public static Object handleXml(InputStream in) { XMLDecoder d = new XMLDecoder(in); try { Object result = d.readObject(); //Deserialization happen here return result; } finally { d.close(); } } }