3 ms·
Other than a possible checksum calculated from the entire file contents, many binary formats use either: - Headers describing a section, including the length
by Varriount 6y ago
Other than a possible checksum calculated from the entire file contents, many binary formats use either:
- Headers describing a section, including the length of a section.
- Prefixing each section with a size.
- Using a marker pattern (such as a null byte) to mark the end of a section of data.
(there are more than these three, but these are the most common)
That last one isn't used very often, and when it is, it's mostly for textual data.
The consequence of using the first two techniques is that it's entirely possible to add data to the end of the format, since a parser would just read the last section and stop (assuming the format supports knowing what the last section is).