Hi
I'm using Scala to serialize List[Report]
Where these are the 2 classes involved:
case class Topic(name:String, queryWords:Set[String]) and
case class Report(dateRange: org.joda.time.Interval, queryWord:
String, topics: Map[Topic,Boolean], allOtherTopics: Map[Topic,Boolean])
It has no problems serializing List[Report], but it cannot read it back in. It throws this exception:
com.esotericsoftware.kryo.KryoException: Class cannot be created (missing no-arg constructor): scala.collection.immutable.$colon$colon
This is the code that I used to do the serialization:
val output = new Output(new FileOutputStream(reportsRootPath + reportsFileName))
kryo.writeClassAndObject(output, reports)
output.close()
This is the code I use to do deserialization:
val input = new Input(new FileInputStream(reportsRootPath + reportsFileName))
val zzz=kryo.readClassAndObject(input)
return Some(zzz.asInstanceOf[List[Report]])
I also tried deserializing with (with no success):
val input = new ObjectInputStream(new FileInputStream(reportsRootPath + reportsFileName))
val obj:List[Report] = input.readObject().asInstanceOf[List[Report]]
val obj= input.readObject
I've also looked at this question
http://stackoverflow.com/questions/16490912/how-do-you-deserialize-immutable-collection-using-kryobut the proposed solution does not compile for me
So how can I deserialize my list of reports?
Thanks