Hi, I wrote a binary parser combinator(ish) library that uses java's input/outputstreams (https://github.com/smee/binary) that may help (add [org.clojars.smee/binary "0.2.0"] to your project's leiningen dependencies).
As I use streams, I have no way of knowing the size of a binary blob beforehand, so in principal you have three options: Using a length prefix, using an arbitrary prefix or iteratively read floats until you run out of bytes: > (use 'org.clojars.smee.binary.core)) > > >> (def codec-prefix (repeated :float :prefix :int)) > > (def codec-length (repeated :float :length 50)) > > (def codec-simple (compile-codec :float)) > > >> ;; call with either > > (defn by-prefix [^java.io.InputStream in] > > (decode codec-prefix in)) > > >> (defn by-length [^java.io.InputStream in] > > (decode codec-length in)) > > >> (defn by-greedy [^java.io.InputStream in] > > (take-while (complement nil?) > > (repeatedly #(try > > (decode codec-simple in) > > (catch java.io.EOFException e nil))))) > > >> Each call would return a sequence of floats. You can write a sequence of floats back with "encode", of course. Currently the documentation is nothing to be proud of, but it is in the pipeline. Instead please refer to the beginning of an mp3 idv2 parser at https://github.com/smee/binary/blob/master/src/org/clojars/smee/binary/demo/mp3.clj or the tests of the project. Steffen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en