suzaku-io / boopickle

Binary serialization library for efficient network communication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to access pickled bytes

ioleo opened this issue · comments

commented

Hey, working on Scalajs 1 with boopickle 1.4.0.

import boopickle.shapeless.Default._
val session = ??? // some case class
val buffer = Pickle.intoBytes(session)
val bytes = buffer.array // throws UnsupportedOperationException

Is that just "how it works" in Scalajs - I have no way of accessing these bytes? Or am I doing something wrong?
The idea is to serialize some session data into bytes which I can later send to the server.

Is there a way around it? Can the pickler return an array of bytes instead of ByteBuffer?

Looking at scala.js source code that error is thrown if array is null.