[swift-users] Parsing binary data

Jens Alfke 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.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160708/4973c65e/attachment.html>


More information about the swift-users mailing list