[scala]Can Fury support serializing Seq collections and case classes in Scala, and then deserializing the resulting objects into corresponding Java objects in Java?
xiaxianggo opened this issue · 1 comments
xiaxianggo commented
Can furry support serializing Seq collections and case classes in Scala, and then deserializing the resulting objects into corresponding Java objects in Java?
chaokunyang commented
Hi @xiaxianggo , you can register a customized serializer for this:
class SeqSerializer extends AbstractCollectionSerializer {
@Override
public Collection onCollectionWrite(MemoryBuffer buffer, Object value) {
}
@Override
public Object read(MemoryBuffer buffer) {
}
@Override
public Collection newCollection(MemoryBuffer buffer) {
int numElements = buffer.readVarUint32Small7();
setNumElements(numElements);
ArrayList arrayList = new ArrayList(numElements);
fury.getRefResolver().reference(arrayList);
return arrayList;
}
@Override
public Object onCollectionRead(Collection collection) {
}
}
Take org.apache.fury.serializer.collection.CollectionSerializers.ArrayListSerializer
as an example