Faster Java Serialization 0.22 review

Download
by rbytes.net on

Faster Java Serializations goal of the project is to enable faster serialization by generating bytecodes on the fly to serialize obje

License: GPL (GNU General Public License)
File size: 0K
Developer: Leonardo Mesquita
0 stars award from rbytes.net

Faster Java Serializations 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:
Custom serialization through java.io.Externalizable
Custom serialization through writeObject, readObject, writeReplace, readResolve or any other special serialization method.
Inner/Local/Anonymous class serialization.
Serialization of non-static final fields, though no error will arise when serializing objects that have such fields.

Faster Java Serialization 0.22 search tags