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

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

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

ByteBuf.readMediumLE介绍

[英]Gets a 24-bit medium integer at the current readerIndexin the Little Endian Byte Order and increases the readerIndex by 3 in this buffer.
[中]在当前readerIndex处以小尾端字节顺序获取24位中整数,并在此缓冲区中将readerIndex增加3。

代码示例

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

@Override
public int readMediumLE() {
  return buf.readMediumLE();
}

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

/**
 * Read 3 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 3 byte fixed length integer
 */
public int readInt3() {
  return byteBuf.readMediumLE() & 0xffffff;
}

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

/**
 * Read 3 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 3 byte fixed length integer
 */
public int readInt3() {
  return byteBuf.readMediumLE() & 0xffffff;
}

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

@Override
public int readMediumLE() {
  return buf.readMediumLE();
}

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

@Override
public int readMediumLE() {
  return buf.readMediumLE();
}

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

@Override
public int readMediumLE() {
  return byteBuf.readMediumLE();
}

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

@Override
public int readMediumLE() {
  checkReadableBytes(3);
  return buffer.readMediumLE();
}

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

@Override
public int readMediumLE() {
  checkReadableBytes(3);
  return buffer.readMediumLE();
}

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

@Override
protected void doDecode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
  int payloadLength = in.markReaderIndex().readMediumLE();
  int realPacketLength = payloadLength + MySQLPacket.PAYLOAD_LENGTH + MySQLPacket.SEQUENCE_LENGTH;
  if (readableBytes < realPacketLength) {
    in.resetReaderIndex();
    return;
  }
  out.add(in.readRetainedSlice(payloadLength + MySQLPacket.SEQUENCE_LENGTH));
}

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

@Override
protected void doDecode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
  int payloadLength = in.markReaderIndex().readMediumLE();
  int realPacketLength = payloadLength + MySQLPacket.PAYLOAD_LENGTH + MySQLPacket.SEQUENCE_LENGTH;
  if (readableBytes < realPacketLength) {
    in.resetReaderIndex();
    return;
  }
  out.add(in.readRetainedSlice(payloadLength + MySQLPacket.SEQUENCE_LENGTH));
}

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

@Override
public int readMediumLE() {
  checkReadableBytes(3);
  return buffer.readMediumLE();
}

代码示例来源: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 Position parsePositionReport(
    DeviceSession deviceSession, ByteBuf buf, int sequenceNumber, long timestamp) {
  Position position = new Position(getProtocolName());
  position.set(Position.KEY_INDEX, sequenceNumber);
  position.setDeviceId(deviceSession.getDeviceId());
  position.setTime(convertTimestamp(timestamp));
  position.setLatitude(buf.readMediumLE() * 0.00002);
  position.setLongitude(buf.readMediumLE() * 0.00002);
  position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
  position.setCourse(buf.readUnsignedByte() * 2);
  short flags = buf.readUnsignedByte();
  position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40);
  buf.readUnsignedByte(); // reserved
  return position;
}

代码示例来源:origin: io.netty/netty-buffer

@Override
public int readMediumLE() {
  return buf.readMediumLE();
}

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

position.setAltitude(buf.readMediumLE());

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public int readMediumLE() {
  return buf.readMediumLE();
}

代码示例来源:origin: io.netty/netty-codec

@Override
public int readMediumLE() {
  checkReadableBytes(3);
  return buffer.readMediumLE();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int readMediumLE() {
  checkReadableBytes(3);
  return buffer.readMediumLE();
}

相关文章

ByteBuf类方法