[swift-users] Parsing binary data
jens at mooseyard.com
Fri Jul 8 11:35:35 CDT 2016
> On Jul 8, 2016, at 2:12 AM, Tino Heth via swift-users <swift-users at swift.org> wrote:
> But arrays are no option for me, because my data isn't structured that way:
> It's a stream of different elements (timestamp, type, and a payload that depends on the type), so I have evaluate byte-by-byte…
This is the sort of thing a good stream API should be able to handle efficiently, i.e. methods to read/write various binary data types like integers. Or alternatively, an API to encode/decode those types into an ArraySlice (like Go’s encoding/binary package.)
Hopefully these can be added to the Swift standard library. In the interim, something like that Go package could be implemented with some small C functions callable from Swift.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users