本文整理了Java中org.apache.tinkerpop.shaded.kryo.Kryo.readClassAndObject()
方法的一些代码示例,展示了Kryo.readClassAndObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.readClassAndObject()
方法的具体详情如下:
包路径:org.apache.tinkerpop.shaded.kryo.Kryo
类名称:Kryo
方法名:readClassAndObject
暂无
代码示例来源:origin: JanusGraph/janusgraph
@Override
public P read(Kryo kryo, Input input, Class<P> aClass) {
final String predicate = input.readString();
final boolean isCollection = input.readByte() == (byte) 0;
final Object value;
if (isCollection) {
value = new ArrayList();
final int size = input.readInt();
for (int ix = 0; ix < size; ix++) {
((List) value).add(kryo.readClassAndObject(input));
}
} else {
value = kryo.readClassAndObject(input);
}
try {
return createPredicateWithValue(predicate, value);
} catch (final Exception e) {
log.info("Couldn't deserialize class: " + aClass + ", predicate: " + predicate + ", isCollection: "
+ isCollection + ",value: " + value, e);
throw new IllegalStateException(e.getMessage(), e);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Vertex read(final Kryo kryo, final Input input, final Class<Vertex> vertexClass) {
return (Vertex) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public VertexProperty read(final Kryo kryo, final Input input, final Class<VertexProperty> vertexPropertyClass) {
return (VertexProperty) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Edge read(final Kryo kryo, final Input input, final Class<Edge> edgeClass) {
final Object o = kryo.readClassAndObject(input);
return (Edge) o;
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Property read(final Kryo kryo, final Input input, final Class<Property> propertyClass) {
return (Property) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Path read(final Kryo kryo, final Input input, final Class<Path> pathClass) {
return (Path) kryo.readClassAndObject(input);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Map.Entry read(final Kryo kryo, final Input input, final Class<Map.Entry> entryClass) {
return new AbstractMap.SimpleEntry(kryo.readClassAndObject(input), kryo.readClassAndObject(input));
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Tuple2<A, B> read(final Kryo kryo, final Input input, final Class<Tuple2<A, B>> clazz) {
return new Tuple2(kryo.readClassAndObject(input), kryo.readClassAndObject(input));
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public Tuple3<A, B, C> read(final Kryo kryo, final Input input, final Class<Tuple3<A, B, C>> clazz) {
return new Tuple3(kryo.readClassAndObject(input), kryo.readClassAndObject(input), kryo.readClassAndObject(input));
}
}
代码示例来源:origin: hugegraph/hugegraph
@Override
public Optional<?> read(Kryo kryo, Input input, Class<Optional<?>> c) {
Object value = kryo.readClassAndObject(input);
return value == null ? Optional.empty() : Optional.of(value);
}
}
代码示例来源:origin: apache/tinkerpop
/**
* {@inheritDoc}
*/
@Override
public <C> C readObject(final InputStream inputStream, final Class<? extends C> clazz) throws IOException {
return clazz.cast(this.kryo.readClassAndObject(new Input(inputStream)));
}
代码示例来源:origin: apache/tinkerpop
@Override
public Object readClassAndObject(final ShadedInputAdapter input) {
return shadedKryo.readClassAndObject(input.getShadedInput());
}
代码示例来源:origin: hugegraph/hugegraph
@SuppressWarnings("unused")
private static Map<HugeKeys, Object> readEntry(Kryo kryo, Input input) {
int columnSize = input.readInt();
Map<HugeKeys, Object> map = new LinkedHashMap<>();
for (int i = 0; i < columnSize; i++) {
HugeKeys key = kryo.readObject(input, HugeKeys.class);
Object val = kryo.readClassAndObject(input);
map.put(key, val);
}
return map;
}
代码示例来源:origin: apache/tinkerpop
@Override
public WrappedArray<T> read(final Kryo kryo, final Input input, final Class<WrappedArray<T>> aClass) {
final int size = input.readVarInt(true);
final Object[] array = new Object[size];
for (int i = 0; i < size; i++) {
array[i] = kryo.readClassAndObject(input);
}
return new WrappedArray.ofRef<>((T[]) array);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public <T> T deserialize(final ByteBuffer byteBuffer, final ClassTag<T> classTag) {
this.input.setBuffer(byteBuffer.array());
return this.gryoSerializer.getGryoPool().readWithKryo(kryo -> (T) kryo.readClassAndObject(this.input));
}
代码示例来源:origin: apache/tinkerpop
@Override
public <T> T deserialize(final ByteBuffer byteBuffer, final ClassLoader classLoader, final ClassTag<T> classTag) {
this.input.setBuffer(byteBuffer.array());
return this.gryoSerializer.getGryoPool().readWithKryo(kryo -> {
kryo.setClassLoader(classLoader);
return (T) kryo.readClassAndObject(this.input);
});
}
代码示例来源:origin: apache/tinkerpop
@Override
public Optional<Vertex> readVertex(final InputStream inputStream, final GraphFilter graphFilter) throws IOException {
StarGraphGryoSerializer serializer = this.graphFilterCache.get(graphFilter);
if (null == serializer) {
serializer = StarGraphGryoSerializer.withGraphFilter(graphFilter);
this.graphFilterCache.put(graphFilter, serializer);
}
final Input input = new Input(inputStream);
this.readHeader(input);
final StarGraph starGraph = this.kryo.readObject(input, StarGraph.class, serializer);
// read the terminator
this.kryo.readClassAndObject(input);
return Optional.ofNullable(starGraph == null ? null : starGraph.getStarVertex());
}
代码示例来源:origin: apache/tinkerpop
private Vertex readVertexInternal(final Function<Attachable<Vertex>, Vertex> vertexMaker,
final Function<Attachable<Edge>, Edge> edgeMaker,
final Direction d,
final Input input) throws IOException {
readHeader(input);
final StarGraph starGraph = kryo.readObject(input, StarGraph.class);
// read the terminator
kryo.readClassAndObject(input);
final Vertex v = vertexMaker.apply(starGraph.getStarVertex());
if (edgeMaker != null)
starGraph.getStarVertex().edges(d).forEachRemaining(e -> edgeMaker.apply((Attachable<Edge>) e));
return v;
}
代码示例来源:origin: apache/tinkerpop
@Override
public Object readClassAndObject(final InputStream inputStream) {
return HadoopPools.getGryoPool().readWithKryo(kryo -> kryo.readClassAndObject(new Input(inputStream)));
}
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!