Package com.esotericsoftware.kryo.serialize

Examples of com.esotericsoftware.kryo.serialize.CollectionSerializer


  }

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


    FieldSerializer mediaContentSerializer = (FieldSerializer)kryo.getSerializer(MediaContent.class);
    mediaContentSerializer.setFieldsCanBeNull(false);

    CachedField imagesField = mediaContentSerializer.getField("_images");
    CollectionSerializer imagesSerializer = new CollectionSerializer(kryo);
    imagesSerializer.setElementClass(Image.class);
    imagesSerializer.setElementsCanBeNull(false);
    imagesSerializer.setLength(2);
    imagesField.setClass(ArrayList.class, imagesSerializer);

    CachedField mediaField = mediaContentSerializer.getField("_media");
    FieldSerializer mediaSerializer = new FieldSerializer(kryo, Media.class);
    mediaSerializer.setFieldsCanBeNull(false);
    mediaField.setClass(Media.class, mediaSerializer);

    CachedField personsField = mediaSerializer.getField("_persons");
    CollectionSerializer personsSerializer = new CollectionSerializer(kryo);
    personsSerializer.setElementClass(String.class);
    personsSerializer.setElementsCanBeNull(false);
    personsSerializer.setLength(2);
    personsField.setClass(ArrayList.class, personsSerializer);

    mediaSerializer.getField("_copyright").setCanBeNull(true);
  }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.serialize.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.