Thursday, 5 November 2009

XStream : The Simplest XML serializer

Serializing XML to (Java) objects and back just became simpler with what is being touted as the fastest and the simplest XML serializer, XStream.

According to this bench marking excercise, XStream is the fastest Serializer to hit our Java objects. While marshalling and unmarshalling is a time consuming task, using XStream would definitely be a performance boost. But while speed and its low memory foot print are talking points, it is simply easy to use. The XStream two minute tutorial takes TWO MINUTES to read and digest. The only slightly disconcerting aspect is that releases are few and far apart.

One a final note, if you are looking for an XML serializer that serialises with no hang ups, XStream might fit the bill but be aware that using XStream is like traveling in the economy class of a budget airline and while you might get home, you cannot expect too many features. For features, pick up JaxB 2.1 or XMLBeans.

Tuesday, 20 October 2009

One JAR for all your JARs

Sometimes it is more convenient to package your Java application into a single JAR which includes all dependencies and works just like an executable. This seemingly simple objective becomes complicated when the dependencies include other JAR files as one can run into JAR Hell with the Java Class Loader. One possibility of achieving the goal of having a single executable jar is using One Jar.
The unique aspect of OneJar is that dependencies can be bundled into the executable Jar in their native form without unpacking the classes and the custom class loader resolves and loads required classes from within the dependent jars. The default Java class loader can only load classes from the file system, it cannot look inside other jars for the required classes. To achieve loading of classes from within other jars, a custom class loader is required which is provided by One Jar.One Jar also provides an Ant and a Maven2 task and can be easily integrated into your build cycle.

Tuesday, 6 October 2009

Scalable Vector Graphics

Scalable Vector Graphics provide a rich source of functionality that allow applications to manipulate and respond to the user interactions with the image. Creating and modifying SVG images is possible using one of the several open source tools available.

Batik SVG Toolkit is an impressive Java based open source SVG toolkit that provides libraries for the dynamic manipulation of SVG objects from within a Java application. While Batik provides a rich array of functionality, it somewhat lacks a good WYSIWYG editor.

A good WYSIWYG editor for SVG Graphics is provided by Inkscape which is another open source SVG editor with several advanced editing features such as (markers, clones, alpha blending, etc.)