JavaBin - Apache Solr JavaBin (de)serializer
use JavaBin; my $result = from_javabin $binary_data;
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.
my $result = from_javabin $binary_data;
Accepts one argument, a binary string 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.
Java data types are mapped to Perl ones as follows.
A null is returned as undef.
True and false are returned as 1 and 0 respectively.
Integers of all size are returned as scalars, with the requirement of a 64bit Perl for longs.
A float is returned as a scalar, with the requirement of a 64bit Perl for large values.
A date is returned as a string in ISO 8601 format. This may change to be a Date object like DateTime in future.
A map is returned as a hash.
An iterator is flattened into an array.
All strings are returned as strings with the UTF-8 flag on.
An array is returned as an array.
A SimpleOrderedMap is returned as an array. This will likely change to be a tied hash like Tie::IxHash in future.
A NamedList is returned as an array. This will likely change to be a tied hash or object in future.
This package was inspired by the Ruby JavaBin library. Both that library and the Java JavaBin library proved very helpful in understanding JavaBin.
James Raspass <email@example.com>
This software is copyright (c) 2013 by James Raspass <firstname.lastname@example.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.