NOTE: sixbs is officially retired.

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.

One of the users of sixbs are the folks from g4j (GMail API for Java).

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 ( java.lang.Float, java.lang.Long, etc), String and URL. This list might grow in the future. All other classes are asked for their properties and these are written to XML. Only classes that have a no arg constructor may be serialized this way.

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 com.tagtraum.sixbs.adapters package and its subpackages.

If you want to serialize only some of the properties of an object you may implement the com.tagtraum.sixbs.SIXBSSerializable interface.


Using sixbs is simple. Just write your objects with a SIXBSWriter to an OutputStream or with a Writer. If you want to read the object 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
SIXBSReader in = new SIXBSReader(new FileReader("myBean.xml"));
// de-serialize b2
MyBean b2 = (MyBean)in.readObject();

For further info please see the provided javadocs in the distribution.


sixbs is published under the LGPL. Besides the copyleft issues, this means that you are very welcome to contribute! We are especially interested in bundling more Adapters for standard JDK classes in future releases.