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

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

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

ByteBuf.readShortLE介绍

[英]Gets a 16-bit short integer at the current readerIndexin the Little Endian Byte Order and increases the readerIndexby 2 in this buffer.
[中]获取当前ReaderIndex处的一个16位短整数(以小尾数字节顺序),并在此缓冲区中将ReaderIndex增加2。

代码示例

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

@Override
public short readShortLE() {
  return buf.readShortLE();
}

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

/**
 * Read 2 byte fixed length integer from byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
 *
 * @return 2 byte fixed length integer
 */
public int readInt2() {
  return byteBuf.readShortLE() & 0xffff;
}

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

@Override
public short readShortLE() {
  return buf.readShortLE();
}

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

/**
 * Read 2 byte fixed length integer from byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
 *
 * @return 2 byte fixed length integer
 */
public int readInt2() {
  return byteBuf.readShortLE() & 0xffff;
}

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

@Override
public short readShortLE() {
  return buf.readShortLE();
}

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

@Override
public short readShortLE() {
  return byteBuf.readShortLE();
}

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

@Override
public short readShortLE() {
  checkReadableBytes(2);
  return buffer.readShortLE();
}

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

@Override
public short readShortLE() {
  checkReadableBytes(2);
  return buffer.readShortLE();
}

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

@Override
public short readShortLE() {
  checkReadableBytes(2);
  return buffer.readShortLE();
}

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

/**
 * Read lenenc integer from byte buffers.
 *
 * @return lenenc integer
 */
public long readIntLenenc() {
  int firstByte = readInt1();
  if (firstByte < 0xfb) {
    return firstByte;
  }
  if (0xfb == firstByte) {
    return 0;
  }
  if (0xfc == firstByte) {
    return byteBuf.readShortLE();
  }
  if (0xfd == firstByte) {
    return byteBuf.readMediumLE();
  }
  return byteBuf.readLongLE();
}

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

/**
 * Read lenenc integer from byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger">LengthEncodedInteger</a>
 *
 * @return lenenc integer
 */
public long readIntLenenc() {
  int firstByte = readInt1();
  if (firstByte < 0xfb) {
    return firstByte;
  }
  if (0xfb == firstByte) {
    return 0;
  }
  if (0xfc == firstByte) {
    return byteBuf.readShortLE();
  }
  if (0xfd == firstByte) {
    return byteBuf.readMediumLE();
  }
  return byteBuf.readLongLE();
}

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

/**
 * Read lenenc integer from byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger">LengthEncodedInteger</a>
 *
 * @return lenenc integer
 */
public long readIntLenenc() {
  int firstByte = readInt1();
  if (firstByte < 0xfb) {
    return firstByte;
  }
  if (0xfb == firstByte) {
    return 0;
  }
  if (0xfc == firstByte) {
    return byteBuf.readShortLE();
  }
  if (0xfd == firstByte) {
    return byteBuf.readMediumLE();
  }
  return byteBuf.readLongLE();
}

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

private void decodeTags(Position position, ByteBuf buf) {
  int blockLength = buf.readUnsignedShort();
  int blockEnd = buf.readerIndex() + blockLength;
  if (blockLength > 0) {
    buf.readUnsignedByte(); // tag type
    int count = buf.readUnsignedByte();
    int tagLength = buf.readUnsignedByte();
    for (int i = 1; i <= count; i++) {
      int tagEnd = buf.readerIndex() + tagLength;
      buf.readUnsignedByte(); // status
      buf.readUnsignedShortLE(); // battery voltage
      position.set(Position.PREFIX_TEMP + i, (buf.readShortLE() & 0x3fff) * 0.1);
      buf.readUnsignedByte(); // humidity
      buf.readUnsignedByte(); // rssi
      buf.readerIndex(tagEnd);
    }
  }
  buf.readerIndex(blockEnd);
}

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

private static void decodeStatus(ByteBuf buf, Position position) {
  position.set(Position.KEY_INPUT, buf.readUnsignedByte());
  position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
  position.set(Position.PREFIX_ADC + 1, buf.readShortLE() * 5.06); // mV
  position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
  position.set(Position.KEY_RSSI, buf.readUnsignedByte());
}

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

position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
position.setCourse(buf.readUnsignedByte() * 2);
position.setAltitude(buf.readShortLE());
  position.set(Position.PREFIX_ADC + i, buf.readShortLE());
buf.readShortLE(); // accelerometer x
buf.readShortLE(); // accelerometer y
buf.readShortLE(); // accelerometer z

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

position.setLongitude(buf.readUnsignedIntLE() * 0.000001);
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE() * 0.01));
position.setAltitude(buf.readShortLE());
position.setCourse(buf.readUnsignedShortLE());
position.setValid(buf.readUnsignedByte() > 0);

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

position.setLatitude(buf.readIntLE() * 0.0000001);
position.setLongitude(buf.readIntLE() * 0.0000001);
position.setAltitude(buf.readShortLE());
position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
      break;
    case 3:
      position.set(Position.KEY_DEVICE_TEMP, buf.readShortLE() * 0.01);
      break;
    case 4:

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

position.setAltitude(buf.readShortLE() / 10.0);
position.setCourse(buf.readUnsignedShortLE());
position.setSpeed(buf.readUnsignedShortLE() * 0.0539957);

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

private void decodeLocation(Position position, ByteBuf buf) {
  DateBuilder dateBuilder = new DateBuilder()
      .setDateReverse(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
      .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte());
  position.setTime(dateBuilder.getDate());
  int flags = buf.readUnsignedByte();
  position.setValid(BitUtil.to(flags, 2) > 0);
  double lat = buf.readUnsignedIntLE() / 3600000.0;
  double lon = buf.readUnsignedIntLE() / 3600000.0;
  position.setLatitude(BitUtil.check(flags, 2) ? lat : -lat);
  position.setLongitude(BitUtil.check(flags, 3) ? lon : -lon);
  position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShortLE()));
  position.setCourse(buf.readUnsignedShortLE() * 0.1);
  position.setAltitude(buf.readShortLE() * 0.1);
}

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

position.set(Position.KEY_DISTANCE, buf.readShortLE());

相关文章

ByteBuf类方法