Java Code Examples for com.esotericsoftware.kryo.Kryo.setDefaultSerializer()

The following are Jave code examples for showing how to use setDefaultSerializer() of the com.esotericsoftware.kryo.Kryo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Rak   File: PlainData.java   Source Code and License Vote up 7 votes
private Kryo createKryoInstance() {
    Kryo kryo = new Kryo();

    kryo.register(RakTable.class);
    kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
    kryo.setReferences(false);

    kryo.register(Collections.singletonList("").getClass(), new ArraysAsListSerializer());
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);
    SynchronizedCollectionsSerializer.registerSerializers(kryo);
    kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(), new CollectionSerializer());
    kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(), new CollectionSerializer());
    kryo.register(UUID.class, new UUIDSerializer());

    for (Class<?> clazz : mCustomSerializers.keySet()) {
        kryo.register(clazz, mCustomSerializers.get(clazz));
    }

    kryo.setInstantiatorStrategy(
            new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));

    return kryo;
}
 
Example 2
Project: react-native-region-monitor   File: PersistableData.java   Source Code and License Vote up 5 votes
@NonNull
private static Kryo createSerialiser()
{
	Kryo serialiser = new Kryo();
	serialiser.setDefaultSerializer(TaggedFieldSerializer.class);
	return serialiser;
}