Wouldn’t it be easier to read them back in a java application and save them as json or an other interop format?
There is no magical solution to read files from an internal java binary format. You could always try to understand and parse the java binary format but that sounds like something that will be a lot of work and possible error prone.
Sure, every language can read it the physical bits, but how do you know what these bits represent? But I guess (because you didn’t specify in your original question) that you need to do something with the files in Elixir, so how do you know what the contents of the file mean?
The information on how the bits are stored are defined by the ObjectOutputStream from java. If you want to read them, you can, and you will have to parse them yourself. Basically implementing an ObjectInputStream in elixir.
So, it would be a lot easier if instead of using the ObjectOutputStream you wrote the files to a json or xml format in java. Then you don’t have to implement the binary parsing yourself.
You could have a look at this site to check how to reverse engineer the binary format. But I still think it would be simpler to write a basic java utility that reads the sample1.zip file and writes it to json/…
I’ve looked at the article @tcoopman linked and while it’s very possible to make a relatively tidy Erlang/Elixir mode that utilizes binary pattern matching, I believe it would be brittle and would surely not cover all cases.
I’d recommend, just as @tcoopman said, you write a small Java utility that reads those serialized HashMaps and dump them in JSON. From then on, every normal language could work with them.
I am usually very interested in inter-operability between languages but in this case you’d be taking the much longer road if you don’t translate the Java serialized objects to JSON using Java itself.