sixbsWhat is sixbs?sixbs is a library capable of writing and reading beans to and from XML using their public properties. sixbs is especially suited for writing configuration data or sending data over the network. Contrary to normal Java serialization it is readable (i.e. you can easily edit it with your favourite text editor) and it is independent from class versions. This means that a new version of a class can be initialized with data from the old class, as long as it has the same or more setter methods. This means that your serialized data is safe even when you update your application classes. sixbs is simple. You don't have to specify a DTD. Most classes are serializable right away. For those that cannot be serialized easily, you can write a simple Adapter class or implement the SIXBSSerializable interface that specifies which getter values should be serialized. How does sixbs work?Each property that has a getter and a setter method is used in the
serialization process. Some classes are serialized as literals. These are
all primitives, their corresponding classes ( If you need to serialize a class that does not have a default constructor you need
to write a com.tagtraum.sixbs.Adapter. Some prewritten Adapters can be found in the
If you want to serialize only some of the properties of an object you may implement the com.tagtraum.sixbs.SIXBSSerializable interface. ExampleIt is really simple to use sixbs. Just write your objects with a SIXBSWriter to an OutputStream or with a Writer. If you want to read the objects again, take a SIXBSReader and simply read from a Reader or InputStream. MyBean b1 = new MyBean(); SIXBSWriter out = new SIXBSWriter(new FileWriter("myBean.xml")); // serialize b1 out.writeObject(b1); out.close(); SIXBSReader in = new SIXBSReader(new FileReader("myBean.xml")); // de-serialize b2 MyBean b2 = (MyBean)in.readObject(); For further info please see the provided javadocs Contributingsixbs is published under the LGPL. Besides the copyleft issues, this means that you are very welcome to contribute! I am especially interested in bundling more Adapters for standard JDK classes in future releases. |