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

x33g5p2x  于2022-01-17 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(148)

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

private static long compareUintLittleEndian(
    ByteBuf bufferA, ByteBuf bufferB, int aIndex, int bIndex, int uintCountIncrement) {
  for (int aEnd = aIndex + uintCountIncrement; aIndex < aEnd; aIndex += 4, bIndex += 4) {
    long comp = (swapInt(bufferA.getInt(aIndex)) & 0xFFFFFFFFL) -
        (swapInt(bufferB.getInt(bIndex)) & 0xFFFFFFFFL);
    if (comp != 0) {
      return comp;
    }
  }
  return 0;
}

代码示例来源:origin: couchbase/java-dcp-client

/**
 * The opaque field contains the opaque value used by messages passing for that VBucket.
 */
public static int opaque(final ByteBuf buffer) {
  return MessageUtil.getExtras(buffer).getInt(0);
}

代码示例来源:origin: couchbase/couchbase-jvm-core

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

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: couchbase/couchbase-jvm-core

private static long compareUintLittleEndian(
    ByteBuf bufferA, ByteBuf bufferB, int aIndex, int bIndex, int uintCountIncrement) {
  for (int aEnd = aIndex + uintCountIncrement; aIndex < aEnd; aIndex += 4, bIndex += 4) {
    long comp = (swapInt(bufferA.getInt(aIndex)) & 0xFFFFFFFFL) -
        (swapInt(bufferB.getInt(bIndex)) & 0xFFFFFFFFL);
    if (comp != 0) {
      return comp;
    }
  }
  return 0;
}

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: com.couchbase.client/core-io

private static long compareUintBigEndianA(
    ByteBuf bufferA, ByteBuf bufferB, int aIndex, int bIndex, int uintCountIncrement) {
  for (int aEnd = aIndex + uintCountIncrement; aIndex < aEnd; aIndex += 4, bIndex += 4) {
    long comp =  bufferA.getUnsignedInt(aIndex) - (swapInt(bufferB.getInt(bIndex)) & 0xFFFFFFFFL);
    if (comp != 0) {
      return comp;
    }
  }
  return 0;
}

代码示例来源:origin: com.couchbase.client/core-io

private static long compareUintBigEndianB(
    ByteBuf bufferA, ByteBuf bufferB, int aIndex, int bIndex, int uintCountIncrement) {
  for (int aEnd = aIndex + uintCountIncrement; aIndex < aEnd; aIndex += 4, bIndex += 4) {
    long comp =  (swapInt(bufferA.getInt(aIndex)) & 0xFFFFFFFFL) - bufferB.getUnsignedInt(bIndex);
    if (comp != 0) {
      return comp;
    }
  }
  return 0;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

private static long compareUintBigEndianB(
    ByteBuf bufferA, ByteBuf bufferB, int aIndex, int bIndex, int uintCountIncrement) {
  for (int aEnd = aIndex + uintCountIncrement; aIndex < aEnd; aIndex += 4, bIndex += 4) {
    long comp =  (swapInt(bufferA.getInt(aIndex)) & 0xFFFFFFFFL) - bufferB.getUnsignedInt(bIndex);
    if (comp != 0) {
      return comp;
    }
  }
  return 0;
}

代码示例来源:origin: couchbase/java-dcp-client

public static StreamEndReason reason(final ByteBuf buffer) {
    int flags = MessageUtil.getExtras(buffer).getInt(0);
    return StreamEndReason.of(flags);
  }
}

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: couchbase/couchbase-jvm-core

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

代码示例来源:origin: couchbase/java-dcp-client

public static ByteBuf getRawContent(ByteBuf buffer) {
  short keyLength = buffer.getShort(KEY_LENGTH_OFFSET);
  byte extrasLength = buffer.getByte(EXTRAS_LENGTH_OFFSET);
  int contentLength = buffer.getInt(BODY_LENGTH_OFFSET) - keyLength - extrasLength;
  return buffer.slice(HEADER_SIZE + keyLength + extrasLength, contentLength);
}

代码示例来源:origin: com.couchbase.client/core-io

@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: couchbase/java-dcp-client

public static void setExtras(ByteBuf extras, ByteBuf buffer) {
  byte oldExtrasLength = buffer.getByte(EXTRAS_LENGTH_OFFSET);
  byte newExtrasLength = (byte) extras.readableBytes();
  int oldBodyLength = buffer.getInt(BODY_LENGTH_OFFSET);
  int newBodyLength = oldBodyLength - oldExtrasLength + newExtrasLength;
  buffer.setByte(EXTRAS_LENGTH_OFFSET, newExtrasLength);
  buffer.setInt(BODY_LENGTH_OFFSET, newBodyLength);
  buffer.setBytes(HEADER_SIZE, extras);
  buffer.writerIndex(HEADER_SIZE + newBodyLength);
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@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: com.couchbase.client/core-io

@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: couchbase/couchbase-jvm-core

@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;
  }
}

相关文章