本文整理了Java中com.esotericsoftware.kryo.Kryo.readClass()
方法的一些代码示例,展示了Kryo.readClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.readClass()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:readClass
[英]Reads a class and returns its registration.
[中]读取类并返回其注册。
代码示例来源: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: apache/hive
@Override
public Registration readClass(Input input) {
Registration reg = super.readClass(input);
if (reg != null) {
ponderGlobalPreReadHook(reg.getType()); // Needed to intercept readClassAndObject.
}
return reg;
}
代码示例来源:origin: apache/hive
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<List<?>> type) {
final int length = input.readInt(true);
Class<?> componentType = kryo.readClass(input).getType();
if (componentType.isPrimitive()) {
componentType = getPrimitiveWrapperClass(componentType);
}
try {
final Object items = Array.newInstance(componentType, length);
for (int i = 0; i < length; i++) {
Array.set(items, i, kryo.readClassAndObject(input));
}
return Arrays.asList((Object[]) items);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: de.javakaffee/kryo-serializers
@SuppressWarnings( { "unchecked", "rawtypes" } )
private EnumMap<? extends Enum<?>, ?> create(final Kryo kryo, final Input input,
final Class<? extends EnumMap<? extends Enum<?>, ?>> type) {
final Class<? extends Enum<?>> keyType = kryo.readClass( input ).getType();
return new EnumMap( keyType );
}
代码示例来源:origin: magro/kryo-serializers
@SuppressWarnings( { "unchecked", "rawtypes" } )
private EnumMap<? extends Enum<?>, ?> create(final Kryo kryo, final Input input,
final Class<? extends EnumMap<? extends Enum<?>, ?>> type) {
final Class<? extends Enum<?>> keyType = kryo.readClass( input ).getType();
return new EnumMap( keyType );
}
代码示例来源:origin: de.javakaffee/kryo-serializers
@Override
public EnumSet read(final Kryo kryo, final Input input, final Class<? extends EnumSet<? extends Enum<?>>> type) {
final Class<Enum> elementType = kryo.readClass( input ).getType();
final EnumSet result = EnumSet.noneOf( elementType );
final int size = input.readInt(true);
final Enum<?>[] enumConstants = elementType.getEnumConstants();
for ( int i = 0; i < size; i++ ) {
result.add( enumConstants[input.readInt(true)] );
}
return result;
}
代码示例来源:origin: magro/kryo-serializers
@Override
public EnumSet read(final Kryo kryo, final Input input, final Class<? extends EnumSet<? extends Enum<?>>> type) {
final Class<Enum> elementType = kryo.readClass( input ).getType();
final EnumSet result = EnumSet.noneOf( elementType );
final int size = input.readInt(true);
final Enum<?>[] enumConstants = elementType.getEnumConstants();
for ( int i = 0; i < size; i++ ) {
result.add( enumConstants[input.readInt(true)] );
}
return result;
}
代码示例来源:origin: com.esotericsoftware/kryo
public Class read (Kryo kryo, Input input, Class<Class> type) {
Registration registration = kryo.readClass(input);
int isPrimitive = input.read();
Class typ = registration != null ? registration.getType() : null;
if (typ == null || !typ.isPrimitive()) return typ;
return (isPrimitive == 1) ? typ : getWrapperClass(typ);
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
public Class read (Kryo kryo, Input input, Class<Class> type) {
Registration registration = kryo.readClass(input);
int isPrimitive = input.read();
Class typ = registration != null ? registration.getType() : null;
if (typ == null || !typ.isPrimitive()) return typ;
return (isPrimitive == 1) ? typ : getWrapperClass(typ);
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
public Class read (Kryo kryo, Input input, Class<Class> type) {
Registration registration = kryo.readClass(input);
int isPrimitive = input.read();
Class typ = registration != null ? registration.getType() : null;
if (typ == null || !typ.isPrimitive()) return typ;
return (isPrimitive == 1) ? typ : getWrapperClass(typ);
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
public EnumSet read (Kryo kryo, Input input, Class<EnumSet> type) {
Registration registration = kryo.readClass(input);
EnumSet object = EnumSet.noneOf(registration.getType());
Serializer serializer = registration.getSerializer();
int length = input.readInt(true);
for (int i = 0; i < length; i++)
object.add(serializer.read(kryo, input, null));
return object;
}
代码示例来源:origin: org.apache.beam/beam-runners-apex
@Override
public void read(Kryo kryo, Input input) {
try {
@SuppressWarnings("unchecked")
Class<Coder<T>> type = kryo.readClass(input).getType();
coder = kryo.readObject(input, type, JAVA_SERIALIZER);
value = coder.decode(input, Context.OUTER);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: com.esotericsoftware/kryo
public EnumSet read (Kryo kryo, Input input, Class<EnumSet> type) {
Registration registration = kryo.readClass(input);
EnumSet object = EnumSet.noneOf(registration.getType());
Serializer serializer = registration.getSerializer();
int length = input.readInt(true);
for (int i = 0; i < length; i++)
object.add(serializer.read(kryo, input, null));
return object;
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
public EnumSet read (Kryo kryo, Input input, Class<EnumSet> type) {
Registration registration = kryo.readClass(input);
EnumSet object = EnumSet.noneOf(registration.getType());
Serializer serializer = registration.getSerializer();
int length = input.readInt(true);
for (int i = 0; i < length; i++)
object.add(serializer.read(kryo, input, null));
return object;
}
代码示例来源:origin: DataSystemsLab/GeoSpark
private Object readUserData(Kryo kryo, Input input)
{
Object userData = null;
if (input.readBoolean()) {
Registration clazz = kryo.readClass(input);
userData = kryo.readObject(input, clazz.getType());
}
return userData;
}
代码示例来源:origin: hank-whu/turbo-rpc
@SuppressWarnings("unchecked")
public static Object slowRead(Kryo kryo, Input input) {
Registration registration = kryo.readClass(input);
if (registration == null) {
return null;
} else {
Serializer<?> serializer = registration.getSerializer();
return kryo.readObject(input, registration.getType(), serializer);
}
}
代码示例来源:origin: de.javakaffee/kryo-serializers
@Override
public Object read(final Kryo kryo, final Input input, final Class<? extends Object> type) {
final Class<?> superclass = kryo.readClass( input ).getType();
final Class<?>[] interfaces = kryo.readObject(input, Class[].class);
final Callback[] callbacks = kryo.readObject(input, Callback[].class);
return createProxy( superclass, interfaces, callbacks );
}
代码示例来源:origin: uk.gov.gchq.gaffer/spark-library
@Override
public Edge read(final Kryo kryo, final Input input, final Class<Edge> type) {
final String group = input.readString();
Registration reg = kryo.readClass(input);
final Object source = kryo.readObject(input, reg.getType());
reg = kryo.readClass(input);
final Object dest = kryo.readObject(input, reg.getType());
final boolean directed = input.readBoolean();
final Properties properties = kryo.readObjectOrNull(input, Properties.class);
return new Edge(group, source, dest, directed, null, properties);
}
}
代码示例来源:origin: magro/kryo-serializers
@Override
public Object read(final Kryo kryo, final Input input, final Class<? extends Object> type) {
final Class<?> superclass = kryo.readClass( input ).getType();
final Class<?>[] interfaces = kryo.readObject(input, Class[].class);
final Callback[] callbacks = kryo.readObject(input, Callback[].class);
return createProxy( superclass, interfaces, callbacks );
}
代码示例来源: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!