本文整理了Java中com.esotericsoftware.kryo.Kryo.readClassAndObject()
方法的一些代码示例,展示了Kryo.readClassAndObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.readClassAndObject()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:readClassAndObject
[英]Reads the class and object or null using the registered serializer.
[中]使用注册的序列化程序读取类和对象或null。
代码示例来源:origin: apache/incubator-dubbo
@Override
public Object readObject() throws IOException, ClassNotFoundException {
// TODO optimization
try {
return kryo.readClassAndObject(input);
} catch (KryoException e) {
throw new IOException(e);
}
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public Object readObject() throws IOException, ClassNotFoundException {
// TODO optimization
try {
return kryo.readClassAndObject(input);
} catch (KryoException e) {
throw new IOException(e);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public T deserialize(byte[] b) {
Input input = new Input(b);
return (T) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/storm
@Override
public T deserialize(byte[] b) {
Input input = new Input(b);
return (T) kryo.get().readClassAndObject(input);
}
代码示例来源:origin: changmingxie/tcc-transaction
public T execute(Kryo kryo) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Input input = new Input(byteArrayInputStream);
return (T) kryo.readClassAndObject(input);
}
});
代码示例来源:origin: apache/storm
/**
* Returns an Object which is created using Kryo deserialization of given {@code byteBuffer} instance.
*
* @param byteBuffer byte buffer to be deserialized into an Object
*/
public Object deserialize(ByteBuffer byteBuffer) {
input.setBuffer(byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.position());
return kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/storm
/**
* Returns an Object which is created using Kryo deserialization of given byte array instance.
*
* @param buff byte array to be deserialized into an Object
*/
public Object deserialize(byte[] buff) {
input.setBuffer(buff);
return kryo.readClassAndObject(input);
}
代码示例来源:origin: apache/storm
public Object deserializeObject(byte[] ser) {
_kryoInput.setBuffer(ser);
return _kryo.readClassAndObject(_kryoInput);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public T deserialize(byte[] b) {
input.setBuffer(b);
return (T) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: changmingxie/tcc-transaction
public static <T> T readFromByteArray(byte[] byteArray) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
Input input = new Input(byteArrayInputStream);
Kryo kryo = getInstance();
return (T) kryo.readClassAndObject(input);
}
代码示例来源:origin: alibaba/jstorm
public Object deserializeObject(byte[] ser) throws IOException {
_kryoInput.setBuffer(ser);
return _kryo.readClassAndObject(_kryoInput);
}
代码示例来源:origin: changmingxie/tcc-transaction
public static <T> T readFromByteArray(byte[] byteArray) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
Input input = new Input(byteArrayInputStream);
Kryo kryo = getInstance();
return (T) kryo.readClassAndObject(input);
}
代码示例来源:origin: apache/storm
private Object getKryoDeserializedObject (final byte[] ser) {
final Kryo kryo = new Kryo();
final Input input = new Input(new ByteArrayInputStream(ser));
kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());
return kryo.readClassAndObject(input);
}
代码示例来源:origin: apache/hive
@Override
public Object readClassAndObject(Input input) {
return ponderGlobalPostHook(super.readClassAndObject(input));
}
代码示例来源:origin: atomix/atomix
@Override
public List<?> read(Kryo kryo, Input input, Class<List<?>> type) {
final int size = input.readInt(true);
List<Object> list = new ArrayList<>(size);
for (int i = 0; i < size; ++i) {
list.add(kryo.readClassAndObject(input));
}
return list;
}
}
代码示例来源:origin: qiujiayu/AutoLoadCache
@Override
public Object deserialize(byte[] serialized) {
Kryo kryo = pool.borrow();
try (Input input = new Input(new ByteArrayInputStream(serialized))) {
Object o = kryo.readClassAndObject(input);
return o;
} finally {
pool.release(kryo);
}
}
代码示例来源:origin: apache/hive
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<List<?>> clazz) {
kryo.reference(FAKE_REFERENCE);
final List<?> list = (List<?>) kryo.readClassAndObject(input);
final int fromIndex = input.readInt(true);
final int toIndex = input.readInt(true);
return list.subList(fromIndex, toIndex);
}
代码示例来源:origin: orbit/orbit
@Override
public ReferenceReplacement read(Kryo kryo, Input input, Class<ReferenceReplacement> type)
{
ReferenceReplacement referenceReplacement = new ReferenceReplacement();
referenceReplacement.interfaceClass = kryo.readClass(input).getType();
referenceReplacement.id = kryo.readClassAndObject(input);
referenceReplacement.address = readNodeAddress(input);
return referenceReplacement;
}
}
代码示例来源:origin: redisson/redisson
@Override
public Object decode(ByteBuf buf, State state) throws IOException {
Kryo kryo = null;
try {
kryo = kryoPool.get();
return kryo.readClassAndObject(new Input(new ByteBufInputStream(buf)));
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new RedissonKryoCodecException(e);
} finally {
if (kryo != null) {
kryoPool.yield(kryo);
}
}
}
};
代码示例来源:origin: redisson/redisson
@Override
public Object decode(ByteBuf buf, State state) throws IOException {
Kryo kryo = null;
try {
kryo = kryoPool.get();
return kryo.readClassAndObject(new Input(new ByteBufInputStream(buf)));
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new RedissonKryoCodecException(e);
} finally {
if (kryo != null) {
kryoPool.yield(kryo);
}
}
}
};
内容来源于网络,如有侵权,请联系作者删除!