use of de.javakaffee.kryoserializers.ArraysAsListSerializer in project Paper by pilgr.
the class DbStoragePlainFile method createKryoInstance.
private Kryo createKryoInstance() {
Kryo kryo = new Kryo();
kryo.register(PaperTable.class);
kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
kryo.setReferences(false);
// Serialize Arrays$ArrayList
//noinspection ArraysAsListWithZeroOrOneArgument
kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
// Serialize inner AbstractList$SubAbstractListRandomAccess
kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(), new NoArgCollectionSerializer());
// Serialize AbstractList$SubAbstractList
kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(), new NoArgCollectionSerializer());
// To keep backward compatibility don't change the order of serializers above
// UUID support
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;
}
use of de.javakaffee.kryoserializers.ArraysAsListSerializer in project quasar by puniverse.
the class KryoUtil method registerCommonClasses.
public static void registerCommonClasses(Kryo kryo) {
kryo.register(boolean[].class);
kryo.register(byte[].class);
kryo.register(short[].class);
kryo.register(char[].class);
kryo.register(int[].class);
kryo.register(float[].class);
kryo.register(long[].class);
kryo.register(double[].class);
kryo.register(String[].class);
kryo.register(int[][].class);
kryo.register(java.util.ArrayList.class);
kryo.register(java.util.LinkedList.class);
kryo.register(java.util.HashMap.class);
kryo.register(java.util.LinkedHashMap.class);
kryo.register(java.util.TreeMap.class);
kryo.register(java.util.EnumMap.class);
kryo.register(java.util.HashSet.class);
kryo.register(java.util.TreeSet.class);
kryo.register(java.util.EnumSet.class);
kryo.register(java.util.Arrays.asList("").getClass(), new ArraysAsListSerializer());
kryo.register(java.util.Collections.newSetFromMap(new java.util.HashMap()).getClass(), new CollectionsSetFromMapSerializer());
// kryo.register(java.util.Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
// kryo.register(java.util.Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
// kryo.register(java.util.Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());
// kryo.register(java.util.Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer());
// kryo.register(java.util.Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer());
// kryo.register(java.util.Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer());
kryo.register(java.util.GregorianCalendar.class, new GregorianCalendarSerializer());
kryo.register(java.lang.reflect.InvocationHandler.class, new JdkProxySerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
kryo.addDefaultSerializer(Externalizable.class, new ExternalizableKryoSerializer());
kryo.addDefaultSerializer(java.lang.ref.Reference.class, new ReferenceSerializer());
}
Aggregations