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

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

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

ByteBuf.readIntLE介绍

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

代码示例

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

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

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

/**
 * Read 4 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 4 byte fixed length integer
 */
public int readInt4() {
  return byteBuf.readIntLE();
}

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

/**
 * Read 4 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 4 byte fixed length integer
 */
public int readInt4() {
  return byteBuf.readIntLE();
}

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

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

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

/**
 * Gets a 32-bit floating point number at the current {@code readerIndex}
 * in Little Endian Byte Order and increases the {@code readerIndex}
 * by {@code 4} in this buffer.
 *
 * @throws IndexOutOfBoundsException
 *         if {@code this.readableBytes} is less than {@code 4}
 */
public float readFloatLE() {
  return Float.intBitsToFloat(readIntLE());
}

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

/** Read a 32-bit little-endian integer from the stream. */
public int readRawLittleEndian32() throws IOException {
  return buf.readIntLE();
}

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

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

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

/**
 * Gets a 32-bit floating point number at the current {@code readerIndex}
 * in Little Endian Byte Order and increases the {@code readerIndex}
 * by {@code 4} in this buffer.
 *
 * @throws IndexOutOfBoundsException
 *         if {@code this.readableBytes} is less than {@code 4}
 */
public float readFloatLE() {
  return Float.intBitsToFloat(readIntLE());
}

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

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

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

/**
 * Gets a 32-bit floating point number at the current {@code readerIndex}
 * in Little Endian Byte Order and increases the {@code readerIndex}
 * by {@code 4} in this buffer.
 *
 * @throws IndexOutOfBoundsException
 *         if {@code this.readableBytes} is less than {@code 4}
 */
public float readFloatLE() {
  return Float.intBitsToFloat(readIntLE());
}

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

@Override
public int readIntLE() {
  checkReadableBytes(4);
  return buffer.readIntLE();
}

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

@Override
public int readIntLE() {
  checkReadableBytes(4);
  return buffer.readIntLE();
}

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

@Override
public int readIntLE() {
  checkReadableBytes(4);
  return buffer.readIntLE();
}

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

int offset = in.readIntLE();

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

return NOT_ENOUGH_INPUT;
  length = in.readIntLE();
  break;
default:

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

private Object decode(ByteBuf buf, State state, Decoder<?> decoder) throws IOException {
  int keyLen;
  if (isWindows) {
    keyLen = buf.readIntLE();
  } else {
    keyLen = (int) buf.readLongLE();
  }
  ByteBuf keyBuf = buf.readSlice(keyLen);
  Object key = decoder.decode(keyBuf, state);
  return key;
}

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

private Object decode(ByteBuf buf, State state, Decoder<?> decoder) throws IOException {
  int keyLen;
  if (isWindows) {
    keyLen = buf.readIntLE();
  } else {
    keyLen = (int) buf.readLongLE();
  }
  ByteBuf keyBuf = buf.readSlice(keyLen);
  Object key = decoder.decode(keyBuf, state);
  return key;
}

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

@Override
  public Object decode(ByteBuf buf, State state) throws IOException {
    List<Object> result = new ArrayList<Object>();
    int keyLen;
    if (PlatformDependent.isWindows()) {
      keyLen = buf.readIntLE();
    } else {
      keyLen = (int) buf.readLongLE();
    }
    ByteBuf keyBuf = buf.readSlice(keyLen);
    Object key = codec.getMapKeyDecoder().decode(keyBuf, state);
    result.add(key);
    int valueLen;
    if (PlatformDependent.isWindows()) {
      valueLen = buf.readIntLE();
    } else {
      valueLen = (int) buf.readLongLE();
    }
    ByteBuf valueBuf = buf.readSlice(valueLen);
    Object value = codec.getMapValueDecoder().decode(valueBuf, state);
    result.add(value);
    
    if (sync) {
      double syncId = buf.order(ByteOrder.LITTLE_ENDIAN).readDouble();
      result.add(syncId);
    }
    
    return result;
  }
};

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

@Override
  public Object decode(ByteBuf buf, State state) throws IOException {
    List<Object> result = new ArrayList<Object>();
    int keyLen;
    if (PlatformDependent.isWindows()) {
      keyLen = buf.readIntLE();
    } else {
      keyLen = (int) buf.readLongLE();
    }
    ByteBuf keyBuf = buf.readSlice(keyLen);
    Object key = codec.getMapKeyDecoder().decode(keyBuf, state);
    result.add(key);
    int valueLen;
    if (PlatformDependent.isWindows()) {
      valueLen = buf.readIntLE();
    } else {
      valueLen = (int) buf.readLongLE();
    }
    ByteBuf valueBuf = buf.readSlice(valueLen);
    Object value = codec.getMapValueDecoder().decode(valueBuf, state);
    result.add(value);
    
    if (sync) {
      double syncId = buf.order(ByteOrder.LITTLE_ENDIAN).readDouble();
      result.add(syncId);
    }
    
    return result;
  }
};

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

private Position parsePositionReport2(
    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.readIntLE() * 0.0000001);
  position.setLongitude(buf.readIntLE() * 0.0000001);
  buf.readUnsignedByte(); // report trigger
  position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
  short flags = buf.readUnsignedByte();
  position.setValid((flags & 0x80) == 0x80 && (flags & 0x40) == 0x40);
  position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
  position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
  return position;
}

相关文章

ByteBuf类方法