I need to implement a feature that will log data packets received from an external device to a file. Later on this file should be used for replaying this data to simulate the device. It's not possible to hold all data in memory so I need process data packet by packet.
I'm looking for a serialization mechanism that supports adding an unknown number of packets to a file and later on reload it again packet by packet. Ideally the output is human readable e.g. json but this is not a must have.
I've had a look at scala pickling but I think I would need all data in memory. Are there any better/easier ways other than manually implementing this? Would this kind of stream processing be possible using google protobuf or any related library?