Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2012 12:53
Show Gist options
  • Save anonymous/2359128 to your computer and use it in GitHub Desktop.
Save anonymous/2359128 to your computer and use it in GitHub Desktop.
package com.samples;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import com.thoughtworks.xstream.*;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class Reader {
public static void main(String[] args) throws IOException,
ClassNotFoundException {
XStream xs = new XStream(new DomDriver());
xs.alias("Root", ObjectPars.class);
xs.alias("Element", Param.class);
try {
FileInputStream fis = new FileInputStream(
"D:/My java workspace/sampleproject/tmp/AlmPos- ID.xml");
// ObjectInputStream in = xs.createObjectInputStream(fis);
// ObjectPars op = (ObjectPars) in.readObject();
ObjectPars op = (ObjectPars) xs.fromXML(fis);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment