io.netty.buffer.ByteBuf.writeFloat()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(177)

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

ByteBuf.writeFloat介绍

[英]Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4in this buffer.
[中]在当前writerIndex处设置指定的32位浮点数,并在此缓冲区中将writerIndex增加4。

代码示例

代码示例来源:origin: netty/netty

@Override
public ByteBuf writeFloat(float value) {
  buf.writeFloat(value);
  return this;
}

代码示例来源:origin: netty/netty

@Override
public void writeFloat(float v) throws IOException {
  buffer.writeFloat(v);
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf writeFloat(float value) {
  buf.writeFloat(value);
  return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

public Buffer appendFloat(float f) {
 buffer.writeFloat(f);
 return this;
}

代码示例来源:origin: redisson/redisson

@Override
public void writeFloat(float v) throws IOException {
  buffer.writeFloat(v);
}

代码示例来源:origin: netty/netty

/**
 * Creates a new 4-byte big-endian buffer that holds the specified 32-bit floating point number.
 */
public static ByteBuf copyFloat(float value) {
  ByteBuf buf = buffer(4);
  buf.writeFloat(value);
  return buf;
}

代码示例来源:origin: netty/netty

/**
 * Create a new big-endian buffer that holds a sequence of the specified 32-bit floating point numbers.
 */
public static ByteBuf copyFloat(float... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 4);
  for (float v: values) {
    buffer.writeFloat(v);
  }
  return buffer;
}

代码示例来源:origin: wildfly/wildfly

@Override
public ByteBuf writeFloat(float value) {
  buf.writeFloat(value);
  return this;
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Override
public ByteBuf writeFloat(float value) {
  byteBuf.writeFloat(value);
  return this;
}

代码示例来源:origin: wildfly/wildfly

@Override
public void writeFloat(float v) throws IOException {
  buffer.writeFloat(v);
}

代码示例来源:origin: redisson/redisson

/**
 * Creates a new 4-byte big-endian buffer that holds the specified 32-bit floating point number.
 */
public static ByteBuf copyFloat(float value) {
  ByteBuf buf = buffer(4);
  buf.writeFloat(value);
  return buf;
}

代码示例来源:origin: redisson/redisson

/**
 * Create a new big-endian buffer that holds a sequence of the specified 32-bit floating point numbers.
 */
public static ByteBuf copyFloat(float... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 4);
  for (float v: values) {
    buffer.writeFloat(v);
  }
  return buffer;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Creates a new 4-byte big-endian buffer that holds the specified 32-bit floating point number.
 */
public static ByteBuf copyFloat(float value) {
  ByteBuf buf = buffer(4);
  buf.writeFloat(value);
  return buf;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Create a new big-endian buffer that holds a sequence of the specified 32-bit floating point numbers.
 */
public static ByteBuf copyFloat(float... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 4);
  for (float v: values) {
    buffer.writeFloat(v);
  }
  return buffer;
}

代码示例来源:origin: apache/incubator-shardingsphere

@Override
  public void write(final PostgreSQLPacketPayload payload, final Object value) {
    payload.getByteBuf().writeFloat(Float.parseFloat(value.toString()));
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public ByteBuf encode(ByteBuf buf, StateChangeMessage message) throws IOException {
    buf.writeByte(message.getReason());
    buf.writeFloat(message.getValue());
    return buf;
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public ByteBuf encode(ByteBuf buf, HealthMessage message) throws IOException {
    buf.writeFloat(message.getHealth());
    ByteBufUtils.writeVarInt(buf, message.getFood());
    buf.writeFloat(message.getSaturation());
    return buf;
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public ByteBuf encode(ByteBuf buf, NamedSoundEffectMessage message) throws IOException {
    ByteBufUtils.writeUTF8(buf, message.getSound());
    ByteBufUtils.writeVarInt(buf, message.getSoundCategory().ordinal());
    buf.writeInt((int) (8 * message.getX()));
    buf.writeInt((int) (8 * message.getY()));
    buf.writeInt((int) (8 * message.getZ()));
    buf.writeFloat(message.getVolume());
    buf.writeFloat(message.getPitch());
    return buf;
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public ByteBuf encode(ByteBuf buf, VehicleMoveMessage message) throws IOException {
    buf.writeDouble(message.getX());
    buf.writeDouble(message.getY());
    buf.writeDouble(message.getZ());
    buf.writeFloat(message.getYaw());
    buf.writeFloat(message.getPitch());
    return buf;
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public ByteBuf encode(ByteBuf buf, ExperienceMessage message) throws IOException {
    buf.writeFloat(message.getBarValue());
    ByteBufUtils.writeVarInt(buf, message.getLevel());
    ByteBufUtils.writeVarInt(buf, message.getTotalExp());
    return buf;
  }
}

相关文章

ByteBuf类方法