A web service is providing a binary chunked application/octet-stream
.
I have to build a reading client in java. I know the structure from some documentation and would like to use that stream as an ObjectInputStream, but before I can call any self made readObject methods, this approach fails, due to java.io.StreamCorruptedException: invalid stream header
.
What's the best way to populate java objects from such a byte stream?
BTW: Data is coming in as LittleEndian, texts as 16bit chars preceeded by 4 byte size info, e.g.
03 00 00 00 41 00 62 00 63 00 (hex)
would result in "Abc"