How to read a whole binary file (Nippy) into byte array in Clojure?

前端 未结 6 1476
Happy的楠姐
Happy的楠姐 2021-01-12 18:05

I need to convert Nippy data structures stored on disk into something that can be read by Nippy? Nippy uses byte arrays, so I need some way to convert the file into a byte a

6条回答
  •  温柔的废话
    2021-01-12 18:32

    You can give a try to ClojureWerk's Buffy : https://github.com/clojurewerkz/buffy.

    Buffy is a Clojure library for working with binary data, writing complete binary protocol implementations in Clojure, storing complex data structures in an off-heap cache, reading binary files and doing everything you would usually do with ByteBuffer.

    It's very neat if your binary data is structured as you can define complex composite types and frames depending on structure types, even decode UTF.

提交回复
热议问题