com.esotericsoftware.kryo.io.Output.writeVarInt()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(121)

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

Output.writeVarInt介绍

[英]Writes a 1-5 byte int. It is guaranteed that a varible length encoding will be used.
[中]写入1-5字节的整数。保证使用可变长度编码。

代码示例

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

public void write(Kryo kryo, Output output, HiveKey object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
 output.writeVarInt(object.hashCode(), false);
}

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

public void write(Kryo kryo, Output output, BytesWritable object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
}

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

public void write(Kryo kryo, Output output, HiveKey object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
}

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

/** Writes a 1-5 byte int. This stream may consider such a variable length encoding request as a hint. It is not guaranteed
 * that a variable length encoding will be really used. The stream may decide to use native-sized integer representation for
 * efficiency reasons.
 * 
 * @param optimizePositive If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
 *           inefficient (5 bytes). */
public int writeInt (int value, boolean optimizePositive) throws KryoException {
  return writeVarInt(value, optimizePositive);
}

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

public void write (Kryo kryo, Output output, byte[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeBytes(object);
}

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

public void write (Kryo kryo, Output output, short[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeShorts(object);
}

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

public void write (Kryo kryo, Output output, double[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeDoubles(object);
}

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

public void write (Kryo kryo, Output output, boolean[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  for (int i = 0, n = object.length; i < n; i++)
    output.writeBoolean(object[i]);
}

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

public void write (Kryo kryo, Output output, byte[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeBytes(object);
}

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

public void write (Kryo kryo, Output output, float[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeFloats(object);
}

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

public void write (Kryo kryo, Output output, double[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeDoubles(object);
}

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

public void write (Kryo kryo, Output output, short[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeShorts(object);
}

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

public void write (Kryo kryo, Output output, int[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeInts(object, false);
}

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

public void write (Kryo kryo, Output output, int[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeInts(object, false);
}

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

public void write (Kryo kryo, Output output, short[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeShorts(object);
}

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

public void write (Kryo kryo, Output output, double[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeDoubles(object);
}

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

public void write (Kryo kryo, Output output, float[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeFloats(object);
}

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

public void write (Kryo kryo, Output output, boolean[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  for (int i = 0, n = object.length; i < n; i++)
    output.writeBoolean(object[i]);
}

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

public void write (Kryo kryo, Output output, T object) {
  CachedField[] fields = getFields();
  output.writeVarInt(writeFieldCount, true); // Can be used for null.
  for (int i = 0, n = fields.length; i < n; i++) {
    if (deprecated[i]) continue;
    output.writeVarInt(tags[i], true);
    fields[i].write(output, object);
  }
}

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

public void write (Kryo kryo, Output output, BigDecimal object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  BigDecimal value = (BigDecimal)object;
  bigIntegerSerializer.write(kryo, output, value.unscaledValue());
  output.writeInt(value.scale(), false);
}

相关文章