Created
April 11, 2012 12:21
-
-
Save anonymous/2359014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
try { | |
FileInputStream fis = new FileInputStream( | |
"D:/My java workspace/sampleproject/tmp/AlmPos- ID.xml"); | |
xs.alias("Root", ObjectPars.class); | |
xs.alias("Element", Param.class); | |
ObjectInputStream in = xs.createObjectInputStream(fis); | |
ObjectPars op = (ObjectPars) in.readObject(); | |
//ObjectPars op = (ObjectPars) xs.fromXML(fis); | |
// xs.fromXML(fis, opr); | |
// Печать десериализованного объекта | |
} catch (FileNotFoundException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment