org.apache.tinkerpop.shaded.kryo.Kryo.readObjectOrNull()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(127)

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

Kryo.readObjectOrNull介绍

暂无

代码示例

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

@Override
public <T> T readObjectOrNull(final ShadedInputAdapter input, final Class<T> type) {
  return shadedKryo.readObjectOrNull(input.getShadedInput(), type);
}

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

@Override
public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
  try {
    final Kryo kryo = kryoThreadLocal.get();
    final byte[] payload = new byte[msg.capacity()];
    msg.readBytes(payload);
    try (final Input input = new Input(payload)) {
      final UUID requestId = kryo.readObjectOrNull(input, UUID.class);
      final int status = input.readShort();
      final String statusMsg = input.readString();
      final Map<String,Object> statusAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
      final Object result = kryo.readClassAndObject(input);
      final Map<String,Object> metaAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
      return ResponseMessage.build(requestId)
          .code(ResponseStatusCode.getFromValue(status))
          .statusMessage(statusMsg)
          .statusAttributes(statusAttributes)
          .result(result)
          .responseMetaData(metaAttributes)
          .create();
    }
  } catch (Exception ex) {
    logger.warn(String.format("Response [%s] could not be deserialized by %s.", msg, AbstractGryoMessageSerializerV1d0.class.getName()), ex);
    throw new SerializationException(ex);
  }
}

代码示例来源:origin: org.apache.tinkerpop/gremlin-core

@Override
public <T> T readObjectOrNull(final ShadedInputAdapter input, final Class<T> type) {
  return shadedKryo.readObjectOrNull(input.getShadedInput(), type);
}

代码示例来源:origin: org.apache.tinkerpop/gremlin-driver

@Override
public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
  try {
    final Kryo kryo = kryoThreadLocal.get();
    final byte[] payload = new byte[msg.capacity()];
    msg.readBytes(payload);
    try (final Input input = new Input(payload)) {
      final UUID requestId = kryo.readObjectOrNull(input, UUID.class);
      final int status = input.readShort();
      final String statusMsg = input.readString();
      final Map<String,Object> statusAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
      final Object result = kryo.readClassAndObject(input);
      final Map<String,Object> metaAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
      return ResponseMessage.build(requestId)
          .code(ResponseStatusCode.getFromValue(status))
          .statusMessage(statusMsg)
          .statusAttributes(statusAttributes)
          .result(result)
          .responseMetaData(metaAttributes)
          .create();
    }
  } catch (Exception ex) {
    logger.warn(String.format("Response [%s] could not be deserialized by %s.", msg, AbstractGryoMessageSerializerV1d0.class.getName()), ex);
    throw new SerializationException(ex);
  }
}

相关文章