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

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

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

Kryo.newInstance介绍

[英]Creates a new instance of a class using Registration#getInstantiator(). If the registration's instantiator is null, a new one is set using #newInstantiator(Class).
[中]使用Registration#getInstantiator()创建类的新实例。如果注册的实例化器为null,则使用#newInstantiator(类)设置一个新的实例化器。

代码示例

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

@Override
  protected Collection createCopy(Kryo kryo, Collection original) {
    return kryo.newInstance(this.type);
  }
}

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

@Override
protected Collection create(Kryo kryo, Input input, Class<Collection> type) {
  return kryo.newInstance(this.type);
}

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

@Override
public T createInstance() {
  if(Modifier.isAbstract(type.getModifiers()) || Modifier.isInterface(type.getModifiers()) ) {
    return null;
  } else {
    checkKryoInitialized();
    try {
      return kryo.newInstance(type);
    } catch(Throwable e) {
      return null;
    }
  }
}

代码示例来源:origin: internetarchive/heritrix3

SerializationException ex = null; 
try {
  return super.newInstance(type);
} catch (SerializationException se) {
  ex = se;

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Collection create (Kryo kryo, Input input, Class<Collection> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Map create (Kryo kryo, Input input, Class<Map> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected T create (Kryo kryo, Input input, Class<T> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Map create (Kryo kryo, Input input, Class<Map> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected T create (Kryo kryo, Input input, Class<T> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Collection create (Kryo kryo, Input input, Class<Collection> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected T create (Kryo kryo, Input input, Class<T> type) {
  return kryo.newInstance(type);
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Used by {@link #copy(Kryo, Object)} to create the new object. This can be overridden to customize object creation, eg to
 * call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected T createCopy (Kryo kryo, T original) {
  return (T)kryo.newInstance(original.getClass());
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Used by {@link #copy(Kryo, Collection)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Collection createCopy (Kryo kryo, Collection original) {
  return kryo.newInstance(original.getClass());
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Used by {@link #copy(Kryo, Collection)} to create the new object. This can be overridden to customize object creation, eg to
 * call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Collection createCopy (Kryo kryo, Collection original) {
  return kryo.newInstance(original.getClass());
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Used by {@link #copy(Kryo, Object)} to create the new object. This can be overridden to customize object creation, eg to
 * call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected T createCopy (Kryo kryo, T original) {
  return (T)kryo.newInstance(original.getClass());
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

/** Used by {@link #copy(Kryo, Collection)} to create the new object. This can be overridden to customize object creation, eg
 * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
protected Collection createCopy (Kryo kryo, Collection original) {
  return kryo.newInstance(original.getClass());
}

代码示例来源:origin: eu.stratosphere/stratosphere-util

@SuppressWarnings("unchecked")
@Override
public DynamicInvokable<MemberType, DeclaringType, ReturnType> copy(final Kryo kryo) {
  final DynamicInvokable<MemberType, DeclaringType, ReturnType> copy = kryo.newInstance(this.getClass());
  ReflectUtil.setField(copy, DynamicInvokable.class, "name", this.name);
  copy.originalSignatures.putAll(this.originalSignatures);
  return copy;
}

代码示例来源: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 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;
  }
}

相关文章