Question

Are there are any examples, tutorials or docs for serialization / pickling / marshalling objects in Scala? I know of existence of scala.util.Marshal and scala.reflect.internal.pickling, but what is a difference between them? how can I use it? Is that some experimetal feature or can I use it in production ... ?

Was it helpful?

Solution

You should use either java serialization (I recommend using the Externalizable approach for complex cases). You can find lots of tutorials by googling "java serialization tutorial".

If you want to stay in Scala, you should have a look to SBinary which uses composable type classes. The project seems old and unmaintained but works like a charm with Scala 2.9.2. There's a tutorial link in the README and I'm currently writing another one.

OTHER TIPS

Not sure about the requirements you have, but it's worth looking at Google's Protocol Buffers and Apache Thrift. Both provide efficient mechanism for serialization.

There is a Protocol Buffers scala compiler ScalaBuff

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top