Just spent some time migrating my minecraft NBT library from to Clojure 1.2.1 to 1.3, had to make a few changes as many clojure.contrib 1.2.0 libraries were moved to separate modules or merged into core. The reliance on clojure.contrib.duck-streams was a tricky one to get around. Most of its functionality was moved to clojure.java.io, but not to-byte-array which was previously used to slurp in the binary .mca files. No much documentation around, but with a few hints from Stack Overflow I ended up with the following:
1 2 3 4 5 |
(defn slurp-binary-file! [^File file] (io! (with-open [reader (io/input-stream file)] (let [buffer (byte-array (.length file))] (.read reader buffer) buffer)))) |
Seems to work so far, passing the current regression tests.