Converting byte[] (ruby persisted Hash) to

Hello everyone,

I have a ruby hash saved in HBase (as an array of bytes of course). What
I need to do is to retrieve it in Java and convert it to whatever might
enable me to use it as a hash map (java.util.HashMap,, whatever…).

Is there a humanly possible way to do this?

Thanks in advance!

On 1 February 2011 14:52, Adnan Karač [email protected] wrote:


Perhaps you can use an UnmarshalStream to get a RubyHash? Untested,
speculative idea!



Hm. I tried turning it using something like this:

ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
object = new ObjectInputStream(bais).readObject();

It throws invalid stream header:
0408433A (i suspect because bytes are not really serialized java object,
so they can’t be converted to one, kinda makes sense :slight_smile: ).

Do you have any examples of use for UnmarshalStream? I haven’t been able
to find any, the problem doesn’t seem to be that common :-S

Thanks for your time!