scodec is a pure functional Scala library that allows encoding/decoding of binary data.
scodec is a suite of Scala combinator libraries for working with binary data. Support ranges from simple, performant data structures for working with bits and bytes to streaming encoding and decoding.
This library focuses on contract-first and pure functional encoding and decoding of binary data. The following design constraints are considered:
- Binary structure should mirror protocol definitions and be self-evident under casual reading
- Mapping binary structures to types should be statically verified
- Encoding and decoding should be purely functional
- Failures in encoding and decoding should provide descriptive errors Compiler plugin should not be used
As a result, the library is implemented as a combinator based DSL. Performance is considered but yields to the above design constraints.
A good place to start using it is to look at the pre-existing codecs and how they can be combined by checking out the available operators.
Links: scodec.org and github.