History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-50
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: ben
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

XStream cant serialise itself.

Created: 29/Apr/04 09:32 PM   Updated: 07/Aug/06 09:34 PM
Component/s: Converters
Affects Version/s: 0.6
Fix Version/s: 1.2

Issue Links:
Related
 
Supercedes
 


 Description  « Hide
Serialising the state of xstream so you can have the same mode of deserialisation at a separate point in time may be important for many applications. This is currently not possible (javaClassConverter is the cause i think).


import com.thoughtworks.xstream.*;

import junit.framework.*;

public class XStreamTesting extends TestCase{

/**
*
*/
public XStreamTesting() {
super("");
}

public void testXStreamSelf(){

XStream stream = new XStream();

stream.setMode(XStream.XPATH_REFERENCES);

System.out.println(stream.toXML(stream));


XStream newStream = (XStream)stream.fromXML(stream.toXML(stream));
}

}

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joe Walnes - 06/Mar/05 05:08 AM
Something to be careful of is that XStream will never be able to serialize itself as whilst it is serializing an object its internal state is changing - dangerous!

However, I see no reason why one XStream instance cannot serialize another XStream instance.

Joe Walnes - 22/Mar/06 10:40 AM
Replaced with XSTR-286

Joerg Schaible - 28/Mar/06 04:33 PM
XStream serialization is somewhat different from detection of self-serialization.

Joerg Schaible - 01/Apr/06 10:59 AM
An XStream instance can now be serialized. Support for enhanced mode or with PureJavaReflectionProvider using JDK 1.5.