How to convert Akka ByteString into String?
You can use the decodeString
method like this:
scala> val x = ByteString("abcd")
x: akka.util.ByteString = ByteString(97, 98, 99, 100)
scala> x.decodeString("US-ASCII")
res0: String = abcd
Use
scala> val data = ByteString("xyz")
data: akka.util.ByteString = ByteString(120, 121, 122)
scala> data.utf8String
res3: String = xyz
see ByteString API,
or on github:
final def utf8String: String = decodeString(StandardCharsets.UTF_8)