Did you allow for chunks not in a fixed order?
Sure, the order is often semi-arbitrary. For example, PNG files have an 8-byte fixed header, the first chunk is IHDR, the last chunk is IEND, but otherwise the chunk order may vary. IDAT chunks contain the image data, and can be split into two or more, it does not need to be a single chunk; the order of the IDAT chunks with respect to each other must be retained, however.
That is, the order of
different types of chunks is often arbitrary, but the order of the same specific type of chunk must be retained; and often one or two initial and sometimes a final chunk are mandatory.
In fact, we could consider TCP (TCPv4 AKA TCP over IPv4, or TCPv6 AKA TCP over IPv6) protocol a chunked format, with their sequence number indicating the position in the stream. Even URGent TCP data is just a 16-bit offset into the packet payload (indicating the end of normal data and the start of URGent data), although TCP stack implementations (are supposed to) treat it as out-of-band data.
text is defined by terminators and I think that's probably more robust than having the expected length noted before the actual data.
Like gps nmea
Yes, NMEA GPS is a stream format, where
$ is the separator (or new message begin marker), and comma
, a field separator marker, and asterisk
* the checksum-follows marker for each message.
It does not matter that much that each field is technically human-readable; most of the data is numeric, and
could be nibble-encoded or even floating-point data, but those would be even more work to parse! The only downside is the relative low density storage for the numbers, but as the messages are quite short and the report interval is in the human scale (as opposed to say thousands of times per second), it does not matter when using typical current standard serial transport methods (as they have plenty of bandwidth for this).
Edit: Not all text formats are stream formats, though. There are fixed-number-of-columns text formats, as well as text-based netstring-like encodings. And of course there are oddball variants between the four classes I showed, TCP in particular, where earlier bits in each chunk can modify the format of the current chunk (header fields). So it isn't a perfect classification system by any means, but it is more useful than "text" versus "binary".