Overload class loading in XStream

Dietcing

New Member
I'm implementing a save/load in NetBeans platform application. And I'm using XStream to serialize to XML.But I have a problem with deserialization. When I was using ObjectInputStream, I've reloaded it this way:\[code\]public class NBSystemClassLoaderObjectInputStream extends ObjectInputStream{ public NBSystemClassLoaderObjectInputStream(InputStream in) throws IOException { super(in); } @Override public Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { ClassLoader currentTccl = Thread.currentThread().getContextClassLoader(); return currentTccl.loadClass(desc.getName()); } catch (Exception e) { } return super.resolveClass(desc); }}\[/code\]So it'll use NB Platform features to find a class. How can I overwrite XStream class loading the same way?
 
Back
Top