Android examples for XML:JAXB
Read Java Bean encoded file to Object
//package com.java2s; import java.beans.XMLDecoder; import java.io.*; public class Main { public static void main(String[] argv) throws Exception { String filename = "java2s.com"; System.out.println(Read(filename)); }//w w w. j a va2 s.co m public static Object Read(String filename) throws FileNotFoundException { XMLDecoder decoder = new XMLDecoder(new BufferedInputStream( new FileInputStream(filename))); Object obj = decoder.readObject(); decoder.close(); return obj; } }