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

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

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

Kryo.readObjectOrNull介绍

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

代码示例

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

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

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

@Override
 public Map read(Kryo kryo, Input input, Class<Map> type) {
  Map map = super.read(kryo, input, type);
  Properties ip = kryo.readObjectOrNull(input, Properties.class);
  ((CopyOnFirstWriteProperties) map).setInterned(ip);
  return map;
 }
}

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

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

代码示例来源:origin: EsotericSoftware/kryonet

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();
    try {
      cachedMethod = getMethods(kryo, methodClass)[methodIndex];
    } catch (IndexOutOfBoundsException ex) {
      throw new KryoException("Invalid method index " + methodIndex + " for class: " + methodClass.getName());
    }
    Serializer[] serializers = cachedMethod.serializers;
    Class[] parameterTypes = cachedMethod.method.getParameterTypes();
    Object[] args = new Object[serializers.length];
    this.args = args;
    for (int i = 0, n = args.length; i < n; i++) {
      Serializer serializer = serializers[i];
      if (serializer != null)
        args[i] = kryo.readObjectOrNull(input, parameterTypes[i], serializer);
      else
        args[i] = kryo.readClassAndObject(input);
    }
    responseData = input.readByte();
  }
}

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

@Override
public <T> T readObjectOrNull(final UnshadedInputAdapter input, final Class<T> type) {
  return unshadedKryo.readObjectOrNull(input.getUnshadedInput(), type);
}

代码示例来源:origin: apache/servicecomb-pack

@Override
 public Object[] deserialize(byte[] message) {
  try {
   Input input = new Input(new ByteArrayInputStream(message));

   Kryo kryo = pool.borrow();
   Object[] objects = kryo.readObjectOrNull(input, Object[].class);
   pool.release(kryo);

   return objects;
  } catch (KryoException e) {
   throw new OmegaException("Unable to deserialize message", e);
  }
 }
}

代码示例来源:origin: bluedavy/McQueenRPC

@Override
 public RequestObject read(Kryo kryo, Input input, Class<RequestObject> type) {
  return kryo.readObjectOrNull(input, type);
 }
}

代码示例来源:origin: bluedavy/McQueenRPC

@Override
 public ResponseObject read(Kryo kryo, Input input,
   Class<ResponseObject> type) {
  return kryo.readObjectOrNull(input, type);
 }
}

代码示例来源:origin: ome/formats-gpl

@Override
public void read(Kryo kryo, Input in) {
 currentFile = kryo.readObjectOrNull(in, String.class);
 attributeList = kryo.readObjectOrNull(in, Vector.class);
 variableList = kryo.readObjectOrNull(in, Vector.class);
 try {
  init();
 }
 catch (IOException e) {
 }
}

代码示例来源:origin: YahooArchive/samoa

@Override
  public Perceptron read(Kryo kryo, Input input, Class<Perceptron> type) {
    PerceptronData perceptronData = kryo.readObjectOrNull(input, PerceptronData.class);
    return perceptronData.build();
  }
}

代码示例来源:origin: YahooArchive/samoa

@Override
  public TargetMean read(Kryo kryo, Input input, Class<TargetMean> type) {
    TargetMeanData data = kryo.readObjectOrNull(input, TargetMeanData.class);
    return data.build();
  }
}

代码示例来源:origin: com.yahoo.labs.samoa/samoa-api

@Override
  public TargetMean read(Kryo kryo, Input input, Class<TargetMean> type) {
    TargetMeanData data = kryo.readObjectOrNull(input, TargetMeanData.class);
    return data.build();
  }
}

代码示例来源:origin: apache/incubator-samoa

@Override
 public Perceptron read(Kryo kryo, Input input, Class<Perceptron> type) {
  PerceptronData perceptronData = kryo.readObjectOrNull(input, PerceptronData.class);
  return perceptronData.build();
 }
}

代码示例来源:origin: org.apache.samoa/samoa-api

@Override
 public Perceptron read(Kryo kryo, Input input, Class<Perceptron> type) {
  PerceptronData perceptronData = kryo.readObjectOrNull(input, PerceptronData.class);
  return perceptronData.build();
 }
}

代码示例来源:origin: com.yahoo.labs.samoa/samoa-api

@Override
  public Perceptron read(Kryo kryo, Input input, Class<Perceptron> type) {
    PerceptronData perceptronData = kryo.readObjectOrNull(input, PerceptronData.class);
    return perceptronData.build();
  }
}

代码示例来源:origin: org.apache.samoa/samoa-api

@Override
 public TargetMean read(Kryo kryo, Input input, Class<TargetMean> type) {
  TargetMeanData data = kryo.readObjectOrNull(input, TargetMeanData.class);
  return data.build();
 }
}

代码示例来源:origin: co.paralleluniverse/galaxy

public <T> T read(InputStream is, Class<T> type) {
    final Input in = getInput();
    in.setInputStream(is);
    return kryo.readObjectOrNull(input, type);
  }
}

代码示例来源:origin: co.paralleluniverse/quasar-core

public <T> T read(InputStream is, Class<T> type) {
    final Input in = getInput();
    in.setInputStream(is);
    return kryo.readObjectOrNull(input, type);
  }
}

代码示例来源:origin: org.onosproject/onos-core-serializers

@Override
public MastershipTerm read(Kryo kryo, Input input, Class<MastershipTerm> type) {
  final NodeId node = kryo.readObjectOrNull(input, NodeId.class, nodeIdSerializer());
  final long term = input.readLong();
  return MastershipTerm.of(node, term);
}

代码示例来源:origin: uk.gov.gchq.gaffer/spark-library

@Override
  public Entity read(final Kryo kryo, final Input input, final Class<Entity> type) {
    final String group = input.readString();
    final Entity entity = new Entity(group);
    final Registration reg = kryo.readClass(input);
    entity.setVertex(kryo.readObject(input, reg.getType()));
    entity.copyProperties(kryo.readObjectOrNull(input, Properties.class));
    return entity;
  }
}

相关文章