Package com.esotericsoftware.kryo

Examples of com.esotericsoftware.kryo.Serializer


    Collection collection = create(kryo, input, type);
    kryo.reference(collection);
    int length = input.readInt(true);
    if (collection instanceof ArrayList) ((ArrayList)collection).ensureCapacity(length);
    Class elementClass = this.elementClass;
    Serializer serializer = this.serializer;
    if (genericType != null) {
      if (serializer == null) {
        elementClass = genericType;
        serializer = kryo.getSerializer(genericType);
      }
View Full Code Here


  public void write (Kryo kryo, Output output, Map map) {
    int length = map.size();
    output.writeInt(length, true);
    if (length == 0) return;

    Serializer keySerializer = this.keySerializer;
    if (keyGenericType != null) {
      if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
      keyGenericType = null;
    }
    Serializer valueSerializer = this.valueSerializer;
    if (valueGenericType != null) {
      if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
      valueGenericType = null;
    }
View Full Code Here

    if (length == 0) return map;

    Class keyClass = this.keyClass;
    Class valueClass = this.valueClass;

    Serializer keySerializer = this.keySerializer;
    if (keyGenericType != null) {
      keyClass = keyGenericType;
      if (keySerializer == null) keySerializer = kryo.getSerializer(keyClass);
      keyGenericType = null;
    }
    Serializer valueSerializer = this.valueSerializer;
    if (valueGenericType != null) {
      valueClass = valueGenericType;
      if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueClass);
      valueGenericType = null;
    }
View Full Code Here

      public Integer read (Kryo kryo, Input input, Class<Integer> type) {
        return input.readInt(true);
      }
    });

    kryo.register(InvocationHandler.class, new Serializer() {
      public void write (Kryo kryo, Output output, Object object) {
        RemoteInvocationHandler handler = (RemoteInvocationHandler)Proxy.getInvocationHandler(object);
        output.writeInt(handler.objectID, true);
      }
View Full Code Here

          break;
        }
      }

      for (int i = 0, n = cachedMethod.serializers.length; i < n; i++) {
        Serializer serializer = cachedMethod.serializers[i];
        if (serializer != null)
          kryo.writeObjectOrNull(output, args[i], serializer);
        else
          kryo.writeClassAndObject(output, args[i]);
      }
View Full Code Here

      }
      method = cachedMethod.method;

      args = new Object[cachedMethod.serializers.length];
      for (int i = 0, n = args.length; i < n; i++) {
        Serializer serializer = cachedMethod.serializers[i];
        if (serializer != null)
          args[i] = kryo.readObjectOrNull(input, method.getParameterTypes()[i], serializer);
        else
          args[i] = kryo.readClassAndObject(input);
      }
View Full Code Here

/**
* This shows how to compress the data with Kryo, but isn't really useful to compare to other serializers.
*/
public class KryoCompressedSerializer extends KryoOptimizedSerializer {
  public KryoCompressedSerializer () {
    Serializer mediaContentSerializer = kryo.getRegisteredClass(MediaContent.class).getSerializer();
    kryo.register(MediaContent.class, new DeflateCompressor(mediaContentSerializer));
  }
View Full Code Here

      }
    };
    resultSerializer.removeField("objectID");
    kryo.register(InvokeMethodResult.class, resultSerializer);

    kryo.register(InvocationHandler.class, new Serializer() {
      public void write (Kryo kryo, Output output, Object object) {
        RemoteInvocationHandler handler = (RemoteInvocationHandler)Proxy.getInvocationHandler(object);
        output.writeInt(handler.objectID, true);
      }
View Full Code Here

      output.writeByte(cachedMethod.methodIndex);

      Serializer[] serializers = cachedMethod.serializers;
      Object[] args = this.args;
      for (int i = 0, n = serializers.length; i < n; i++) {
        Serializer serializer = serializers[i];
        if (serializer != null)
          kryo.writeObjectOrNull(output, args[i], serializer);
        else
          kryo.writeClassAndObject(output, args[i]);
      }
View Full Code Here

      Serializer[] serializers = cachedMethod.serializers;
      Class[] parameterTypes = cachedMethod.method.getParameterTypes();
      Object[] args = new Object[serializers.length];
      this.args = args;
      for (int i = 0, n = args.length; i < n; i++) {
        Serializer serializer = serializers[i];
        if (serializer != null)
          args[i] = kryo.readObjectOrNull(input, parameterTypes[i], serializer);
        else
          args[i] = kryo.readClassAndObject(input);
      }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.Serializer

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.