NAME

JavaBin - Apache Solr JavaBin (de)serializer

VERSION

version 0.2

SYNOPSIS

use JavaBin;

my $result = from_javabin $binary_data;

DESCRIPTION

JavaBin is a compact binary format used by Apache Solr.

For more information on this format see the Solr Wiki.

This package provides a deserializer for this format, with a serializer planned.

FUNCTIONS

from_javabin

my $result = from_javabin $binary_data;

Accepts one argument, a binary string of containing the JavaBin.

Returns a scalar representation of the data, be that undef, number, string, or reference.

This function does no error checking, hand it invalid JavaBin and it will probably die.

CAVEATS

To (de)serialize long floats and ints this package requires a 64bit Perl. That said, it won't actually throw unless it encounters such data, and therefore the tests for such data are skipped on 32bit platforms.

Technically this limitation could be worked around by use of bigint or such. But the added complexity and maintanace cost would outweight the benifit.

Due to the differences between Java and Perl not all data structures can be mapped one-to-one.

An example of such mapping is a Java interator whcih becomes a Perl array during deserialization. Additionally a Java HashMap, Named List, or Ordered Map will become a Perl hash.

TODO

  • to_javabin serializer.

  • XS implementation.

INSPIRATION

This package was inspired by the Ruby JavaBin library. Both that library and the Java JavaBin library proved very helpful in understanding JavaBin.

AUTHOR

James Raspass <jraspass@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by James Raspass <jraspass@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.