Split Serializer

Split Serializer was created due to frustration with the slow perormance of JSON serializers. We were attempting to send moderatly complex data structures to an ActionScript application and noticed that it would pause for several seconds as it parsed the JSON data.

JSON itself was created to be a lighter-weight version of SOAP and XMLRPC -- or even just adhoc XML data. It did this by doing away with the verbose <tags> and replacing them with a JavaScript-like syntax of "key":"value" pairs and brace-delimited lists and maps. In order to get simpler than that, we turned the delimination problem on its head. Instead of having a single set of deliminators and recursively tracking nested levels, we decided to try varying the deliminator itself as a tree's depth went down. The end result is that a consumer can simply split byte arrays (strings) to parse the data.

Some of the principles that Split Serializer uses:

Java Example (from the JUnit test suite for this project):

@Test public void testPublicBeanObject() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SplitSerializer serializer = new SplitSerializer(baos); BeanObject bo = new BeanObject(); byte[] serialized = serializer.serialize(bo); baos.close(); SplitDeserializer deserializer = new SplitDeserializer(); ByteArrayInputStream bais = new ByteArrayInputStream(serialized); Object o = deserializer.deserialize(bais); bais.close(); assert(o instanceof Map); assert(bo.matches((Map)o)); }

And a slightly more customized example from the same test suite, using ASCII encoding and a 55 level limit on tree depth:

@Test public void HighASCIITest() throws Exception { TypeObject to = new TypeObject(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); SplitSerializer serializer = new SplitSerializer(254, 200, baos, "ASCII"); serializer.serialize(to); baos.close(); byte[] serialized = baos.toByteArray(); SplitDeserializer deserializer = new SplitDeserializer((char)254, (char)200, "ASCII"); ByteArrayInputStream bais = new ByteArrayInputStream(serialized); Object o = deserializer.deserialize(bais); assert(o instanceof Map); to.matches((Map)o); // throws exception on error bais.close(); }

All files are available on the Source Forge project page.

Take a look at the javadocs.

Browse all versions here.