Exemple #1
0
    @Override
    public void read(Kryo kryo, Input input) {
      objectID = input.readInt(true);

      int methodClassID = input.readInt(true);
      Class methodClass = kryo.getRegistration(methodClassID).getType();
      byte methodIndex = input.readByte();
      CachedMethod cachedMethod;
      try {
        cachedMethod = getMethods(kryo, methodClass)[methodIndex];
      } catch (IndexOutOfBoundsException ex) {
        throw new KryoException(
            "Invalid method index " + methodIndex + " for class: " + methodClass.getName());
      }
      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);
        }
      }

      responseID = input.readByte();
    }
 @Override
 public void read(Kryo kryo, Input input) {
   this.firstname = input.readString();
   this.lastname = input.readString();
   this.emailAddress = kryo.readObjectOrNull(input, SerializableEmailAddress.class);
   this.addresses = new HashSet<Address>();
   int numAddresses = input.readInt();
   for (int i = 0; i < numAddresses; i++) {
     this.add(kryo.readObject(input, SerializableAddress.class));
   }
 }
 @Override
 public ResponseObject read(Kryo kryo, Input input, Class<ResponseObject> type) {
   return kryo.readObjectOrNull(input, type);
 }