Search code examples
scalaakka

Equivalent of Akka ByteString in Scala standard API


Is anyone aware of a standard API equivalent to Akka's ByteString: http://doc.akka.io/api/akka/2.3.5/index.html#akka.util.ByteString

This very convenient class has no dependency on any other Akka code, and it saddens me to have to import the whole Akka jar just to use it.

I found this fairly old discussion mentioning adding it to the standard API, but I don't know what happened to this project: https://groups.google.com/forum/#!msg/scalaz/ZFcjGpZswRc/0tCIdXvpGBAJ

Does anyone know of an equivalent piece of code in the standard API? Or in a very lightweight library?


Solution

  • You might want to check out scodec-bits. It provides two types, BitVector and ByteVector (API docs), supporting fast appends, take, drop, random access, etc. The library has zero dependencies. We split it out of scodec precisely because we thought it might of general use outside of scodec, where it's used heavily.