C#/.NET - Custom Binary File Formats - Where to Start? -
I should be able to store some data in custom binary file format. I have never designed my own file format, it should be a friendly format for travel between C #, Java and Ruby / Pearl / Python world.
The file will contain records for starting with a GUID field and a JSON / YAML / XML packet field. I'm not sure what to use as a delimiter looks very weak like a comma, tab or new line. What does Excel do? Or the pre-XML OpenOffice format? Should you use ASCII characters 0 or 1. Not sure where to start, any article or books on the topic?
This file format can expand later to include "Header section".
Note: I am working in NAT, but I would like to make the format portable easily.
Update:
"Processing of packets" may be slow, but the file format may not have navigation. So I think the XML is away from the table.
Portable binary file format I will try to add some common signal.
Note that to invent a binary file format means the document, how its bits should go, and what it means is not coding, but documentation.
Now signal:
-
Decide what to do with endlessness Once and for all, it is good and easy to decide Method
-
Create Header .
-
Yes, this is always a header, the first bytes of the file will tell you, what format are you messing around?
- Start with magic to be able to recognize your appearance (ASCII string will do the trick)
- Add version will not hurt to add version of your file format And this will allow you to backward compatibility later. Finally, add data Now, the format of the data will be specific and it will always be based on your exact requirements. Basically, the data will be stored in a binary image of some data structure. The data structure is what you need to come up with.
If you need random access to your data by some type of index, all of them need a lot of numbers to write and then read them all The "array" moves the trick.
In addition, you can use a concept for further compatibility.
Comments
Post a Comment