I want to come up with a binary format for passing data between application instances in a form of POFs (Plain Old Files ;)).
Prerequisites:
- should be cross-platform
- information to be persisted includes a single POJO & arbitrary byte[]s (files actually, the POJO stores it's names in a String[])
- only sequential access is required
- should be a way to check data consistency
- should be small and fast
- should prevent an average user with archiver + notepad from modifying the data
Currently I'm using DeflaterOutputStream + OutputStreamWriter together with InflaterInputStream + InputStreamReader to save/restore objects serialized with XStream, one object per file. Readers/Writers use UTF8. Now, need to extend this to support the previously described. My idea of format:
{serialized to XML object}
{delimiter}
{String file name}{delimiter}{byte[] file data}
{delimiter}
{another String file name}{delimiter}{another byte[] file data}
...
{delimiter}
{delimiter}
{MD5 hash for the entire file}
- Does this look sane?
- What would you use for a delimiter and how would you determine it?
- The right way to calculate MD5 in this case?
- What would you suggest to read on the subject?
TIA.