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

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

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

Kryo.getReferenceResolver介绍

暂无

代码示例

代码示例来源:origin: jerrinot/subzero

@SuppressWarnings("unchecked")
@Test
public void should_use_strategy_with_specified_reference_resolver() throws Exception {
  // given
  System.setProperty("subzero.referenceresolver.class", "info.jerrinot.subzero.internal.strategy.NullReferenceResolver");
  GlobalKryoStrategy kryoStrategy = new GlobalKryoStrategy(NULL_USER_SERIALIZER);
  // when
  Field field = KryoStrategy.class.getDeclaredField("KRYOS");
  field.setAccessible(true);
  Class<? extends ReferenceResolver> actualClassResolver = ((ThreadLocal<KryoContext>) field.get(kryoStrategy))
      .get().getKryo().getReferenceResolver().getClass();
  // then
  assertEquals(NullReferenceResolver.class, actualClassResolver);
}

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

public String[] read (Kryo kryo, Input input, Class<String[]> type) {
  int length = input.readVarInt(true);
  if (length == NULL) return null;
  String[] array = new String[--length];
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0; i < length; i++) {
      array[i] = kryo.readObjectOrNull(input, String.class, serializer);
    }
  } else {
    for (int i = 0; i < length; i++)
      array[i] = input.readString();
  }
  return array;
}

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

public String[] read (Kryo kryo, Input input, Class<String[]> type) {
  int length = input.readVarInt(true);
  if (length == NULL) return null;
  String[] array = new String[--length];
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0; i < length; i++) {
      array[i] = kryo.readObjectOrNull(input, String.class, serializer);
    }
  } else {
    for (int i = 0; i < length; i++)
      array[i] = input.readString();
  }
  return array;
}

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

public String[] read (Kryo kryo, Input input, Class<String[]> type) {
  int length = input.readVarInt(true);
  if (length == NULL) return null;
  String[] array = new String[--length];
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0; i < length; i++) {
      array[i] = kryo.readObjectOrNull(input, String.class, serializer);
    }
  } else {
    for (int i = 0; i < length; i++)
      array[i] = input.readString();
  }
  return array;
}

代码示例来源:origin: svn2github/kryo

public String[] read (Kryo kryo, Input input, Class<String[]> type) {
  int length = input.readVarInt(true);
  if (length == NULL) return null;
  String[] array = new String[--length];
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0; i < length; i++) {
      array[i] = kryo.readObjectOrNull(input, String.class, serializer);
    }
  } else {
    for (int i = 0; i < length; i++)
      array[i] = input.readString();
  }
  return array;
}

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

public void write (Kryo kryo, Output output, String[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0, n = object.length; i < n; i++)
      kryo.writeObjectOrNull(output, object[i], serializer);
  } else {
    for (int i = 0, n = object.length; i < n; i++)
      output.writeString(object[i]);
  }
}

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

public void write (Kryo kryo, Output output, String[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0, n = object.length; i < n; i++)
      kryo.writeObjectOrNull(output, object[i], serializer);
  } else {
    for (int i = 0, n = object.length; i < n; i++)
      output.writeString(object[i]);
  }
}

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

public void write (Kryo kryo, Output output, String[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0, n = object.length; i < n; i++)
      kryo.writeObjectOrNull(output, object[i], serializer);
  } else {
    for (int i = 0, n = object.length; i < n; i++)
      output.writeString(object[i]);
  }
}

代码示例来源:origin: svn2github/kryo

public void write (Kryo kryo, Output output, String[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
    Serializer serializer = kryo.getSerializer(String.class);
    for (int i = 0, n = object.length; i < n; i++)
      kryo.writeObjectOrNull(output, object[i], serializer);
  } else {
    for (int i = 0, n = object.length; i < n; i++)
      output.writeString(object[i]);
  }
}

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new AsmStringField();
} else {

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new UnsafeStringField(field);
} else {

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new UnsafeStringField(field);
} else {

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new AsmStringField();
} else {

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new AsmStringField();
} else {

代码示例来源:origin: svn2github/kryo

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new UnsafeStringField(field);
} else {

代码示例来源:origin: svn2github/kryo

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new AsmStringField();
} else {

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

&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
  cachedField = new UnsafeStringField(field);
} else {

相关文章