SourceForge.net Logo Faster Java Serialization

Copyright (C) 2006 by Leonardo "Bubble" Mesquita

Overview | Documentation | Project page | Downloads | FAQ | Benchmarks

Overview

The goal of the project is to enable faster serialization by generating bytecodes on the fly to serialize objects.

When an object is serialized, its class is inspected and a class that implements the Serializer interface is generated. This class is tailor made to serialize the fields of the given object's class directly.

To serialize objects to a ByteBuffer, all you have to do is add jserial.jar to the classpath and use the SerializationContext class:

	...
	SerializationContext context = new SerializationContext();
	ByteBuffer buffer = ByteBuffer.allocate(1024);
	context.serialize(myObject, buffer);
	...

Serializes myObject. Note that, in order to be serialized, objects must implement java.io.Serializable

To reconstruct the object, all you have to do is use the DeserializationContext class:

	...
	DeserializationContext context = new DeserializationContext();
	MyObject reconstructedObject = (MyObject)context.deserialize(buffer);
	...

Reads the reconstructedObject. In the meantime, the data in the ByteBuffer can easily be written to a file or sent through a network using Java NIO.

This project uses a modified version of Javassist-3.3 to perform code-generation on-the-fly.

Limitations

Currently, the project will only serialize objects that:

Features not yet supported include:

We do not support serialization versioning, nor intend to. The focus of the project is to provide fast serialization, not secure nor "evolving". The user must guarantee that classes of objects being serialized/deserialized with this library have the same version.

Acknowledgements

I'd like to thank the following people for their support:
Faster Java Serialization was developed by Leonardo "Bubble" Mesquita