What is the cleanest way to parse binary data in clojure? I need to be able to read/write equally cleanly to a file or a socket.
something like:
(read-data source-of-data)
=> { :index 42 , :block-size 4 , data-size: 31415, :data (1 2 3 4 ...)}
and the reverse for putting data back. It would be really great to somehow define the structure once and have the read and write functions use the same definition.
From stackoverflow
-
Since Clojure can use native Java functions, why not use those? A quick Googling along those lines gives: http://gnuvince.wordpress.com/2009/01/29/reading-binary-data-in-clojure/
Arthur Ulfeldt : I need to both read and write these fomats though this is a good start. I also need bit level accuracy.
0 comments:
Post a Comment