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

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

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

ByteBuf.getInt介绍

[英]Gets a 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
[中]获取此缓冲区中指定绝对索引处的32位整数。此方法不修改此缓冲区的readerIndex或writerIndex。

代码示例

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

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

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

@Override
public int getIntLE(int index) {
  return buf.getInt(index);
}

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

/**
 * Hashes the 4 bytes located at index, shifting the resulting hash into
 * the appropriate range for our hash table.
 *
 * @param in The input buffer to read 4 bytes from
 * @param index The index to read at
 * @param shift The shift value, for ensuring that the resulting value is
 *     withing the range of our hash table size
 * @return A 32-bit hash of 4 bytes located at index
 */
private static int hash(ByteBuf in, int index, int shift) {
  return in.getInt(index) * 0x1e35a7bd >>> shift;
}

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

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

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

@Override
public int getInt(int index) {
  checkIndex(index, 4);
  return buffer.getInt(index);
}

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

@Override
public int getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
protected int _getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
public int getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
protected int _getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
public int getInt(int index) {
  return ByteBufUtil.swapInt(buf.getInt(index));
}

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

@Override
public int getInt(int index) {
  checkIndex(index, 4);
  return buffer.getInt(index);
}

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

@Override
public int getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
protected int _getInt(int index) {
  return unwrap().getInt(index);
}

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

@Override
protected int _getInt(int index) {
  return unwrap().getInt(idx(index));
}

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

@Override
public int getInt(int index) {
  checkIndex0(index, 4);
  return unwrap().getInt(idx(index));
}

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

@Override
public int getInt(int index) {
  checkIndex0(index, 4);
  return unwrap().getInt(idx(index));
}

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

@Override
protected int _getInt(int index) {
  Component c = findComponent(index);
  if (index + 4 <= c.endOffset) {
    return c.buf.getInt(index - c.offset);
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    return (_getShort(index) & 0xffff) << 16 | _getShort(index + 2) & 0xffff;
  } else {
    return _getShort(index) & 0xFFFF | (_getShort(index + 2) & 0xFFFF) << 16;
  }
}

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

@Override
protected int _getInt(int index) {
  Component c = findComponent0(index);
  if (index + 4 <= c.endOffset) {
    return c.buf.getInt(c.idx(index));
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    return (_getShort(index) & 0xffff) << 16 | _getShort(index + 2) & 0xffff;
  } else {
    return _getShort(index) & 0xFFFF | (_getShort(index + 2) & 0xFFFF) << 16;
  }
}

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

@Override
protected int _getInt(int index) {
  Component c = findComponent(index);
  if (index + 4 <= c.endOffset) {
    return c.buf.getInt(index - c.offset);
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    return (_getShort(index) & 0xffff) << 16 | _getShort(index + 2) & 0xffff;
  } else {
    return _getShort(index) & 0xFFFF | (_getShort(index + 2) & 0xFFFF) << 16;
  }
}

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

@Override
protected int _getInt(int index) {
  Component c = findComponent0(index);
  if (index + 4 <= c.endOffset) {
    return c.buf.getInt(c.idx(index));
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    return (_getShort(index) & 0xffff) << 16 | _getShort(index + 2) & 0xffff;
  } else {
    return _getShort(index) & 0xFFFF | (_getShort(index + 2) & 0xFFFF) << 16;
  }
}

相关文章

ByteBuf类方法