You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've had to modify the example, because Codec.decode now returns an Attempt[DecodeResult[(Int ~ Int ~ Int)]]
The whole example now looks like this:
importscodec._importscodec.bits._importcodecs._// Create a codec for an 8-bit unsigned int followed by an 8-bit unsigned int followed by a 16-bit unsigned intvalfirstCodec= uint8 ~ uint8 ~ uint16
// Decode a bit vector using that codecvalresult:Attempt[DecodeResult[(Int~Int~Int)]] =Codec.decode(BitVector(0x10, 0x2a, 0x03, 0xff))(firstCodec)
// Successful(DecodeResult(((16,42),1023),BitVector(empty)))// Sum the resultvaladd3= (_: Int) + (_: Int) + (_: Int)
valsum:DecodeResult[Int] = result.require.map(add3)
// DecodeResult(1081,BitVector(empty))
I'm using Kryo at the moment. I've heard about scodec and decided to try it.
Sadly none of the examples from README.md work for me.
Since it doesn't say what dependencies to use I took the latest from Maven
Following code can't find codec for
String
error is
I was able to compile it by changing it to
but I doubt it's designed way of using it.
Then following code
doesn't compile because there is no
decode
with such prototype. I guess I can change it tobut returning type is different so
result map add3
doesn't compile because there is nomap
method.Could you please update readme to latest version of the library ?
Thank you.
The text was updated successfully, but these errors were encountered: