ObjectInputStream JS
Java, like most languages, allows you to serialize ("pickle") objects. Its serialization protocol is called the
Object Stream Protocol.
To read it you'd use the java.io.ObjectOutputStream class, and to write it - java.io.ObjectInputStream.
Over the years, several attempts have been made to deserialize that format using JavaScript, but all of them were incomplete, until this one.
| java-deserialization | java-object-serialization | @goodtools/jdserialize | object-input-stream | |
|---|---|---|---|---|
| Full implementation | ❌ | ❌ | ❌ | ✅ |
| Extendable | ✅ | ✅ | ❌ | ✅ |
| Works natively in browser | ❌ | ✅ | ✅ | ✅ |
| Same interface as Java | ❌ | ✅ | ❌ | ✅ |
| Produces AST | ❌ | ❌ | ❌ | ✅ |
What can this library be used for?
Java stream files are used for many things: backups, state files, debug dumps etc.
I wrote this library specifically to parse the packup format of an Android app named FreeOTP.
See demo here.