示例#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();
    }
示例#2
0
 public byte readByte() throws EOFException {
   try {
     return input.readByte();
   } catch (KryoException e) {
     throw maybeEndOfStream(e);
   }
 }
示例#3
0
 public Byte read(Kryo kryo, Input input, Class<Byte> type) {
   return input.readByte();
 }