本文整理了Java中com.esotericsoftware.kryo.Kryo.reference()
方法的一些代码示例,展示了Kryo.reference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.reference()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:reference
[英]Called by Serializer#read(Kryo,Input,Class) and Serializer#copy(Kryo,Object) before Kryo can be used to deserialize or copy child objects. Calling this method is unnecessary if Kryo is not used to deserialize or copy child objects.
[中]在使用Kryo反序列化或复制子对象之前,由序列化程序读取(Kryo,输入,类)和序列化程序复制(Kryo,对象)调用。如果Kryo不用于反序列化或复制子对象,则无需调用此方法。
代码示例来源:origin: apache/hive
@Override
public List<?> copy(final Kryo kryo, final List<?> original) {
try {
kryo.reference(FAKE_REFERENCE);
final List<?> list = (List<?>) _parentField.get(original);
final int parentOffset = _parentOffsetField.getInt( original );
final int fromIndex = parentOffset;
final int toIndex = fromIndex + _sizeField.getInt( original );
return kryo.copy(list).subList(fromIndex, toIndex);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源: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: dremio/dremio-oss
@Override
public T read(final Kryo kryo, final Input input, final Class<T> type) {
final T result = factory.get();
kryo.reference(result);
return result;
}
代码示例来源:origin: de.javakaffee/kryo-serializers
@Override
public List<?> copy(Kryo kryo, List<?> original) {
try {
final Object[] array = (Object[]) _arrayField.get(original);
kryo.reference(array);
Object[] arrayCopy = kryo.copy(array);
return Arrays.asList(arrayCopy);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: magro/kryo-serializers
@Override
public List<?> copy(Kryo kryo, List<?> original) {
try {
final Object[] array = (Object[]) _arrayField.get(original);
kryo.reference(array);
Object[] arrayCopy = kryo.copy(array);
return Arrays.asList(arrayCopy);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: magro/kryo-serializers
@Override
public List<?> copy(Kryo kryo, List<?> original) {
Object singleton = original.get(0);
kryo.reference(singleton);
Object newSingleton = kryo.copy(singleton);
return Collections.singletonList(newSingleton);
}
}
代码示例来源:origin: dremio/dremio-oss
@Override
public ImmutableSet<Object> read(final Kryo kryo, final Input input, final Class<ImmutableSet<Object>> type) {
final int size = input.readInt(true);
final ImmutableSet.Builder builder = ImmutableSet.builder();
for (int i = 0; i < size; ++i) {
builder.add(kryo.readClassAndObject(input));
}
final ImmutableSet<Object> result = builder.build();
kryo.reference(result);
return result;
}
代码示例来源:origin: dremio/dremio-oss
@Override
public T read(final Kryo kryo, final Input input, final Class<T> type) {
try {
final T object = kryo.newInstance(type);
kryo.reference(object);
object.readFields(new DataInputStream(input));
return object;
} catch (final IOException e) {
throw new RuntimeException("unable to deserialize Writable object", e);
}
}
}
代码示例来源:origin: com.esotericsoftware/kryo
public Collection copy (Kryo kryo, Collection original) {
Collection copy = createCopy(kryo, original);
kryo.reference(copy);
for (Object element : original)
copy.add(kryo.copy(element));
return copy;
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
public Collection copy (Kryo kryo, Collection original) {
Collection copy = createCopy(kryo, original);
kryo.reference(copy);
for (Object element : original)
copy.add(kryo.copy(element));
return copy;
}
代码示例来源:origin: com.esotericsoftware/kryo
public KryoSerializable read (Kryo kryo, Input input, Class<KryoSerializable> type) {
KryoSerializable object = kryo.newInstance(type);
kryo.reference(object);
object.read(kryo, input);
return object;
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
public KryoSerializable read (Kryo kryo, Input input, Class<KryoSerializable> type) {
KryoSerializable object = kryo.newInstance(type);
kryo.reference(object);
object.read(kryo, input);
return object;
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
public KryoSerializable read (Kryo kryo, Input input, Class<KryoSerializable> type) {
KryoSerializable object = kryo.newInstance(type);
kryo.reference(object);
object.read(kryo, input);
return object;
}
}
代码示例来源:origin: de.javakaffee/kryo-serializers
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<? extends 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: magro/kryo-serializers
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<? extends 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: de.javakaffee/kryo-serializers
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<? extends 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: magro/kryo-serializers
@Override
public List<?> read(final Kryo kryo, final Input input, final Class<? extends 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: com.esotericsoftware.kryo/kryo
public T copy (Kryo kryo, T original) {
T copy = createCopy(kryo, original);
kryo.reference(copy);
// Copy transient fields
if (copyTransient) {
for (int i = 0, n = transientFields.length; i < n; i++)
transientFields[i].copy(original, copy);
}
for (int i = 0, n = fields.length; i < n; i++)
fields[i].copy(original, copy);
return copy;
}
代码示例来源:origin: com.esotericsoftware/kryo
public T copy (Kryo kryo, T original) {
T copy = createCopy(kryo, original);
kryo.reference(copy);
// Copy transient fields
if (config.isCopyTransient()) {
for (int i = 0, n = transientFields.length; i < n; i++)
transientFields[i].copy(original, copy);
}
for (int i = 0, n = fields.length; i < n; i++)
fields[i].copy(original, copy);
return copy;
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
public T copy (Kryo kryo, T original) {
T copy = createCopy(kryo, original);
kryo.reference(copy);
// Copy transient fields
if (config.isCopyTransient()) {
for (int i = 0, n = transientFields.length; i < n; i++)
transientFields[i].copy(original, copy);
}
for (int i = 0, n = fields.length; i < n; i++)
fields[i].copy(original, copy);
return copy;
}
内容来源于网络,如有侵权,请联系作者删除!