Package com.esotericsoftware.kryo.serializers

Examples of com.esotericsoftware.kryo.serializers.CollectionSerializer


    roundTrip(11, 11, list("1", "2", "3"));
    roundTrip(13, 13, list("1", "2", list("3")));
    roundTrip(13, 13, new LinkedList(list("1", "2", list("3"))));
    roundTrip(13, 13, new CopyOnWriteArrayList(list("1", "2", list("3"))));

    CollectionSerializer serializer = new CollectionSerializer();
    kryo.register(ArrayList.class, serializer);
    kryo.register(LinkedList.class, serializer);
    kryo.register(CopyOnWriteArrayList.class, serializer);
    serializer.setElementClass(String.class, kryo.getSerializer(String.class));
    roundTrip(8, 8, list("1", "2", "3"));
    serializer.setElementClass(String.class, new StringSerializer());
    roundTrip(8, 8, list("1", "2", "3"));
    serializer.setElementsCanBeNull(false);
    roundTrip(8, 8, list("1", "2", "3"));

    kryo.register(TreeSet.class);
    TreeSet set = new TreeSet();
    set.add("1");
View Full Code Here


        methodInfoSerialiser.getField("effectSet").setClass(EffectSet.class, new EffectsSerialiser());
        serialiser.register(MethodInfo.class, methodInfoSerialiser);

        // To serialise the list of MethodInfo objects inside the ClassInfo.
        CollectionSerializer methodInfoListSerialiser = new CollectionSerializer();
        methodInfoListSerialiser.setElementsCanBeNull(false);
        methodInfoListSerialiser.setElementClass(MethodInfo.class, methodInfoSerialiser);

        // Register the list serialiser with the class serialiser.
        classInfoSerialiser.getField("methodInfos").setClass(LinkedList.class, methodInfoListSerialiser);
        serialiser.register(ClassInfo.class, classInfoSerialiser);
    }
View Full Code Here

  }

  static public void register (Kryo kryo) {
    kryo.register(short[].class);
    kryo.register(SomeData.class, new DeflateSerializer(new FieldSerializer(kryo, SomeData.class)));
    kryo.register(ArrayList.class, new CollectionSerializer());
  }
View Full Code Here

    roundTrip(11, 11, list("1", "2", "3"));
    roundTrip(13, 13, list("1", "2", list("3")));
    roundTrip(13, 13, new LinkedList(list("1", "2", list("3"))));
    roundTrip(13, 13, new CopyOnWriteArrayList(list("1", "2", list("3"))));

    CollectionSerializer serializer = new CollectionSerializer();
    kryo.register(ArrayList.class, serializer);
    kryo.register(LinkedList.class, serializer);
    kryo.register(CopyOnWriteArrayList.class, serializer);
    serializer.setElementClass(String.class, kryo.getSerializer(String.class));
    roundTrip(8, 8, list("1", "2", "3"));
    serializer.setElementClass(String.class, new StringSerializer());
    roundTrip(8, 8, list("1", "2", "3"));
    serializer.setElementsCanBeNull(false);
    roundTrip(8, 8, list("1", "2", "3"));

    kryo.register(TreeSet.class);
    TreeSet set = new TreeSet();
    set.add("1");
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.serializers.CollectionSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.