com.esotericsoftware.kryo.Kryo.readObject()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中com.esotericsoftware.kryo.Kryo.readObject()方法的一些代码示例,展示了Kryo.readObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.readObject()方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:readObject

Kryo.readObject介绍

[英]Reads an object using the registered serializer.
[中]使用已注册的序列化程序读取对象。

代码示例

代码示例来源:origin: apache/storm

@Override
  public ListDelegate read(Kryo kryo, Input input, Class<ListDelegate> type) {
    return kryo.readObject(input, ListDelegate.class, serializer);
  }
}

代码示例来源:origin: jersey/jersey

public Object execute(Kryo kryo) {
    return kryo.readObject(input, type);
  }
});

代码示例来源:origin: apache/hive

public static SearchArgument create(byte[] kryoBytes) {
 return kryo.get().readObject(new Input(kryoBytes), SearchArgumentImpl.class);
}

代码示例来源:origin: apache/storm

public List<Object> deserializeFrom(Input input) {
  ListDelegate delegate = _kryo.readObject(input, ListDelegate.class);
  return delegate.getDelegate();
}

代码示例来源:origin: alibaba/jstorm

@Override 
protected Object deserialize(byte[] data) { 
  input.setBuffer(data); 
  return kryo.readObject(input, ArrayList.class); 
}

代码示例来源:origin: alibaba/jstorm

public List<Object> deserialize(Input input) {
  ListDelegate delegate = (ListDelegate) _kryo.readObject(input, ListDelegate.class);
  return delegate.getDelegate();
}

代码示例来源:origin: apache/kylin

public static <T> T deserialize(byte[] bytes, Class<T> clazz) {
  Kryo kryo = getKryo();
  Input input = new Input(bytes);
  return kryo.readObject(input, clazz);
}

代码示例来源:origin: alibaba/jstorm

@Override
public TradeCustomer read(Kryo kryo, Input input, Class<TradeCustomer> arg2) {
  Pair custormer = kryo.readObject(input, Pair.class);
  Pair trade = kryo.readObject(input, Pair.class);
  long timeStamp = input.readLong();
  String buffer = input.readString();
  TradeCustomer inner = new TradeCustomer(timeStamp, trade, custormer, buffer);
  return inner;
}

代码示例来源:origin: redisson/redisson

@Override
  public IN apply(byte[] bytes) {
    IN obj = engine.readObject(new UnsafeMemoryInput(bytes), type);
    if(null != next) {
      next.accept(obj);
      return null;
    } else {
      return obj;
    }
  }
};

代码示例来源:origin: apache/hive

public static <T> T deserialize(byte[] buffer, Class<T> clazz) {
 Kryo kryo = SerializationUtilities.borrowKryo();
 kryo.setClassLoader(Thread.currentThread().getContextClassLoader());
 T result = null;
 try {
  result = kryo.readObject(new Input(new ByteArrayInputStream(buffer)), clazz);
 } finally {
  SerializationUtilities.releaseKryo(kryo);
 }
 return result;
}

代码示例来源:origin: apache/hive

private static <T extends Serializable> T deserializeObjectFromKryo(byte[] bytes, Class<T> clazz) {
 Input inp = new Input(new ByteArrayInputStream(bytes));
 Kryo kryo = borrowKryo();
 T func = null;
 try {
  func = kryo.readObject(inp, clazz);
 } finally {
  releaseKryo(kryo);
 }
 inp.close();
 return func;
}

代码示例来源:origin: apache/kylin

public static <T> T deserialize(final Kryo kryo, final byte[] in, final Class<T> clazz) {
  final Input input = new Input(in);
  return kryo.readObject(input, clazz);
}

代码示例来源:origin: apache/hive

@Override
public <T> T readObject(Input input, Class<T> type) {
 Hook hook = ponderGlobalPreReadHook(type);
 T result = super.readObject(input, type);
 return ponderGlobalPostReadHook(hook, result);
}

代码示例来源:origin: apache/hive

@Override
 public <T> T readObject(Input input, Class<T> type,
   @SuppressWarnings("rawtypes") com.esotericsoftware.kryo.Serializer serializer) {
  Hook hook = ponderGlobalPreReadHook(type);
  T result = super.readObject(input, type, serializer);
  return ponderGlobalPostReadHook(hook, result);
 }
}

代码示例来源:origin: orbit/orbit

@Override
  public Object read(Kryo kryo, Input input, Class type)
  {
    ReferenceReplacement replacement = kryo.readObject(input, ReferenceReplacement.class);
    return BasicRuntime.getRuntime().getReference(replacement.interfaceClass, replacement.id);
  }
}

代码示例来源:origin: orbit/orbit

@Override
  public RemoteReference read(Kryo kryo, Input input, Class type)
  {
    ReferenceReplacement replacement = kryo.readObject(input, ReferenceReplacement.class);
    return BasicRuntime.getRuntime().getReference((Class<RemoteReference>) replacement.interfaceClass, replacement.id);
  }
}

代码示例来源:origin: apache/hive

private static <T> T deserializeObjectByKryo(Kryo kryo, InputStream in, Class<T> clazz ) {
 Input inp = new Input(in);
 kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader());
 T t = kryo.readObject(inp,clazz);
 inp.close();
 return t;
}

代码示例来源:origin: apache/ignite

@Override public TestObject apply() {
    Input kryoIn = null;
    try {
      kryoIn = new Input(new ByteArrayInputStream(out.toByteArray()));
      return kryo.readObject(kryoIn, TestObject.class);
    }
    finally {
      U.close(kryoIn, log);
    }
  }
};

代码示例来源:origin: redisson/redisson

@Override
  public IN apply(byte[] bytes) {
    final Kryo kryo = engine.borrow();
    try {
      IN obj = kryo.readObject(new UnsafeMemoryInput(bytes), type);
      if (null != next) {
        next.accept(obj);
        return null;
      } else {
        return obj;
      }
    } finally {
      engine.release(kryo);
    }
  }
};

代码示例来源:origin: orbit/orbit

@Override
  public Object read(Kryo kryo, Input input, Class type)
  {
    ReferenceReplacement replacement = kryo.readObject(input, ReferenceReplacement.class);
    if (replacement.address != null)
    {
      return BasicRuntime.getRuntime().getRemoteObserverReference(replacement.address, (Class<ActorObserver>) replacement.interfaceClass, replacement.id);
    }
    return BasicRuntime.getRuntime().getReference(replacement.interfaceClass, replacement.id);
  }
}

相关文章