JSX 188.8.131.52 (Tuesday 13 May 2014)
This release further consolidates class evolution, for upgrading data correctly and completely to new class versions (e.g. of Java or third-party libraries).
trial version of JSX jar (97600 bytes)
Please email technical questions to the mailing list
JSX works with Java 1.2, 1.3, 1.4, 1.5, 1.6 and 1.7
Please post bug reports to the mailing list (please
include complete stack traces, XML and code so that the problem can be
reproduced) bug report
Docs for convenience methods are here: JSX.P
XML Schema for JSX: jsx.xsd
Command line test
Cut and paste this "export" test to the command line:
java -classpath JSX184.108.40.206.jar JSX.ObjectWriter > test.xml
Which generates XML something like this:
test.xml (or try this
test.xml.txt for some browsers)
"Import" by cutting and pasting this to the command line:
java -classpath JSX220.127.116.11.jar JSX.ObjectReader < test.xml
or, instead of redirecting standatd input, use an explicit filename:
java -classpath JSX18.104.22.168.jar JSX.ObjectReader test.xml
Edit "test.xml" by hand and import it again - thus, you can process object data
independently of the objects themselves.
Write out an object:
new JSX.ObjectWriter(new FileWriter("my.xml")).writeObject(yourObject);
Note: with older versions of JSX2, you need to explicitly close the stream (or you'll get an EOFException when reading):
JSX.ObjectWriter out = new JSX.ObjectWriter(new FileWriter("my.xml"));
Read it in again:
Object obj = new JSX.ObjectReader(new FileReader("my.xml")).readObject();
Note: in all these examples, you can omit the Writer and Reader argument to the
constructor, and JSX will default to System.out and System.in for convenience
when testing. They also accept OutputStreams and InputStreams.
Switch to JSX
To switch from Java's binary serialization to JSX, you only need to
replace its constructor with JSX. JSX is a drop-in replacement for
standard Java serialization, so nothing else needs to be changed
- only the constructor.
For example, change your code from this...
ObjectOutputStream out = new ObjectOutputStream(myout);
ObjectOutputStream out = new JSX.ObjectWriter(myout);
Do the same for any ObjectInputStream constructors, and that's it! There's
nothing else to do!