What to put in a binary data file's header

前端 未结 12 2263
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 01:52

I have a simulation that reads large binary data files that we create (10s to 100s of GB). We use binary for speed reasons. These files are system dependent, converted from te

12条回答
  •  星月不相逢
    2021-02-06 02:20

    As my experience with telecom equipment configuration and firmware upgrades shows you only really need several predefined bytes at the begin (this is important) which starts from version (fixed part of header). Rest of header is optional, by indicating proper version you can always show how to process it. Important thing here is you'd better place 'variable' part of header at the end of file. If you plan operations on header without modifying file content itself. Also this simplify 'append' operations which should recalculate variable header part.

    Nice to have features for fixed size header (at the begin):

    • Common 'length' field (including header).
    • Something like CRC32 (including header).

    OK, for variable part XML or some pretty extensible format in header is good idea but is it really needed? I had lot of experience with ASN encoding... in most cases its usage was overshot.

    Well, maybe you will have additional understanding when you look at things like TPKT format which is described in RFC 2126 (chapter 4.3).

提交回复
热议问题