Buffy The Byte Buffer Slayer
Buffy is a Clojure library to 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 byte buffers.
Buffy is built on top of Netty byte buffers, which addresses many long standing issues
with java.util.ByteBuffer
.
Key Features
Buffy enables you to access buffers in the similar way you work with the regular Clojure data structures. You can get and set fields separately from one another, give names to different parts of binary representation and so on:
- partial deserialization (read and deserialise parts of a byte buffer)
- named access (access parts of your buffer by names)
- composing/decomposing from key/value pairs
- pretty hexdump
- many useful default types that you can combine and extend easily
Data types used in Buffy buffers include:
- primitive types, such as
int32
,boolean
,byte
,short
,medium
,float
, andlong
- arbitrary-length
string
- byte arrays
- composite types (combine multiple primitive values together)
- repeated type (repeat any primitive arbitrary amount of times in payload)
- enum type (for mapping between human-readable and binary representation of constants)
The 1.0 release
Starting with the 1.0 release Buffy API is considered to be moderately stable. Releases can be expected to follow a very SemVer-like change strategy. Most of the work now will go into minor improvements based on community feedback.
Buffy is a ClojureWerkz Project
Buffy is part of the group of libraries known as ClojureWerkz, together with
- Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
- Cassaforte, a Clojure Cassandra client built around CQL
- Elastisch, a minimalistic Clojure client for ElasticSearch
- Meltdown, Clojure interface to Reactor
- EEP, a Clojure event processing library
- Monger, a Clojure MongoDB client for a more civilized age
- Neocons, a client for the Neo4J REST API
- Quartzite, a powerful scheduling library
and several others. If you like Buffy, you may also like our other projects.
Let us know what you think on Twitter or on the Clojure mailing list.
@michaelklishin on behalf of the ClojureWerkz Team