NAME

JavaBin - Apache Solr JavaBin (de)serializer

VERSION

version 0.4

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.

DATA TYPE MAPPING

Java data types are mapped to Perl ones as follows.

null

A null is returned as undef.

Booleans

True and false are returned as 1 and 0 respectively.

Byte, short, double, int, and long.

Integers of all size are returned as scalars, with the requirement of a 64bit Perl for longs.

Float

A float is returned as a scalar, with the requirement of a 64bit Perl for large values.

Date

A date is returned as a string in ISO 8601 format. This may change to be a Date object like DateTime in future.

Map

A map is returned as a hash.

Iterator

An iterator is flattened into an array.

String

All strings are returned as strings with the UTF-8 flag on.

Array

An array is returned as an array.

SimpleOrderedMap

A SimpleOrderedMap is returned as an array. This will likely change to be a tied hash like Tie::IxHash in future.

NamedList

A NamedList is returned as an array. This will likely change to be a tied hash or object in future.

TODO

  • to_javabin serializer.

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.