An implementation of MessagePack for Scala.
- sbt 0.13.5 or later
Add dependency.
libraryDependencies += "org.msgpack" %% "msgpack-scala" % "0.6.11"
You can import sbt file.
Please type the following command.Then intellij project will be generated.
$ sbt gen-idea
import org.msgpack.annotation.Message
import org.msgpack.ScalaMessagePack
@Message // Don't forget to add Message annotation.
class YourClass{
var name : String = ""
var age : Int = 2
}
val obj = new YourClass()
obj.name = "hoge"
obj.age = 22
val serialized : Array[Byte] = ScalaMessagePack.write(obj)
val deserialized : YourClass = ScalaMessagePack.read[YourClass](serialized)
- Sorry, case classes are not supported now.