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

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

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

ByteBuf.readFloat介绍

[英]Gets a 32-bit floating point number at the current readerIndexand increases the readerIndex by 4 in this buffer.
[中]获取当前readerIndex上的32位浮点数,并在此缓冲区中将readerIndex增加4。

代码示例

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

@Override
public float readFloat() {
  return buf.readFloat();
}

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

@Override
public float readFloat() {
  return buf.readFloat();
}

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

@Override
public float readFloat() {
  return buf.readFloat();
}

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

@Override
public float readFloat() {
  return byteBuf.readFloat();
}

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

@Override
public float readFloat() {
  checkReadableBytes(4);
  return buffer.readFloat();
}

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

@Override
public float readFloat() {
  checkReadableBytes(4);
  return buffer.readFloat();
}

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

@Override
public Object read(final PostgreSQLPacketPayload payload) {
  return payload.getByteBuf().readFloat();
}

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

@Override
public float readFloat() {
  checkReadableBytes(4);
  return buffer.readFloat();
}

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

@Override
public PlayerLookMessage decode(ByteBuf buffer) throws IOException {
  float yaw = buffer.readFloat();
  float pitch = buffer.readFloat();
  boolean onGround = buffer.readBoolean();
  return new PlayerLookMessage(yaw, pitch, onGround);
}

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

@Override
public SteerVehicleMessage decode(ByteBuf buf) throws IOException {
  float sideways = buf.readFloat();
  float forward = buf.readFloat();
  int flags = buf.readUnsignedByte();
  boolean jump = (flags & 0x1) != 0;
  boolean unmount = (flags & 0x2) != 0;
  return new SteerVehicleMessage(sideways, forward, jump, unmount);
}

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

@Override
public HealthMessage decode(ByteBuf buffer) throws IOException {
  float health = buffer.readFloat();
  int food = ByteBufUtils.readVarInt(buffer);
  float saturation = buffer.readFloat();
  return new HealthMessage(health, food, saturation);
}

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

@Override
public PlayerAbilitiesMessage decode(ByteBuf buf) throws IOException {
  int flags = buf.readUnsignedByte();
  float flySpeed = buf.readFloat();
  float walkSpeed = buf.readFloat();
  return new PlayerAbilitiesMessage(flags, flySpeed, walkSpeed);
}

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

@Override
public StateChangeMessage decode(ByteBuf buffer) throws IOException {
  int reason = buffer.readByte();
  float value = buffer.readFloat();
  return new StateChangeMessage(reason, value);
}

代码示例来源:origin: alibaba/Sentinel

return true;
case ClusterConstants.PARAM_TYPE_FLOAT:
  params.add(source.readFloat());
  return true;
case ClusterConstants.PARAM_TYPE_BYTE:

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

@Override
public BlockPlacementMessage decode(ByteBuf buf) throws IOException {
  BlockVector pos = GlowBufUtils.readBlockPosition(buf);
  int direction = buf.readByte();
  int hand = ByteBufUtils.readVarInt(buf);
  float cursorX = buf.readFloat();
  float cursorY = buf.readFloat();
  float cursorZ = buf.readFloat();
  return new BlockPlacementMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(),
    direction, hand, cursorX, cursorY, cursorZ);
}

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

@Override
public VehicleMoveMessage decode(ByteBuf buffer) throws IOException {
  double x = buffer.readDouble();
  double y = buffer.readDouble();
  double z = buffer.readDouble();
  float yaw = buffer.readFloat();
  float pitch = buffer.readFloat();
  return new VehicleMoveMessage(x, y, z, yaw, pitch);
}

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

@Override
public PlayerPositionLookMessage decode(ByteBuf buffer) throws IOException {
  double x = buffer.readDouble();
  double y = buffer.readDouble();
  double z = buffer.readDouble();
  float yaw = buffer.readFloat();
  float pitch = buffer.readFloat();
  boolean onGround = buffer.readBoolean();
  return new PlayerPositionLookMessage(onGround, x, y, z, yaw, pitch);
}

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

@Override
public PositionRotationMessage decode(ByteBuf buffer) throws IOException {
  double x = buffer.readDouble();
  double y = buffer.readDouble();
  double z = buffer.readDouble();
  float rotation = buffer.readFloat();
  float pitch = buffer.readFloat();
  int flags = buffer.readUnsignedByte();
  int teleportId = ByteBufUtils.readVarInt(buffer);
  return new PositionRotationMessage(x, y, z, rotation, pitch, flags, teleportId);
}

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

@Override
public ExperienceMessage decode(ByteBuf buffer) throws IOException {
  float barValue = buffer.readFloat();
  int level = ByteBufUtils.readVarInt(buffer);
  int totalExp = ByteBufUtils.readVarInt(buffer);
  return new ExperienceMessage(barValue, level, totalExp);
}

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

@Override
public InteractEntityMessage decode(ByteBuf buf) throws IOException {
  int id = ByteBufUtils.readVarInt(buf);
  int action = ByteBufUtils.readVarInt(buf);
  if (action == Action.INTERACT_AT.ordinal()) {
    float targetX = buf.readFloat();
    float targetY = buf.readFloat();
    float targetZ = buf.readFloat();
    int hand = ByteBufUtils.readVarInt(buf);
    return new InteractEntityMessage(id, action, targetX, targetY, targetZ, hand);
  } else if (action == Action.INTERACT.ordinal()) {
    int hand = ByteBufUtils.readVarInt(buf);
    return new InteractEntityMessage(id, action, hand);
  }
  return new InteractEntityMessage(id, action);
}

相关文章

ByteBuf类方法