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

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

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

ByteBuf.getByte介绍

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

代码示例

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

private static boolean match(byte[] prefix, ByteBuf buffer, int idx) {
    for (int i = 0; i < prefix.length; i++) {
      final byte b = buffer.getByte(idx + i);
      if (b != prefix[i]) {
        return false;
      }
    }
    return true;
  }
}

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

/**
 * Reads a big-endian (31-bit) integer from the buffer.
 */
static int getUnsignedInt(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0x7F) << 24 |
      (buf.getByte(offset + 1) & 0xFF) << 16 |
      (buf.getByte(offset + 2) & 0xFF) <<  8 |
      buf.getByte(offset + 3) & 0xFF;
}

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

/**
 * If the given buffer is a {@link DcpOpenStreamRequest} message.
 */
public static boolean is(final ByteBuf buffer) {
  return buffer.getByte(0) == MessageUtil.MAGIC_REQ && buffer.getByte(1) == DCP_STREAM_REQUEST_OPCODE;
}

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

/**
 * If the given buffer is a {@link DcpOpenConnectionRequest} message.
 */
public static boolean is(final ByteBuf buffer) {
  return buffer.getByte(0) == MessageUtil.MAGIC_REQ && buffer.getByte(1) == OPEN_CONNECTION_OPCODE;
}

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

/**
 * Reads a big-endian unsigned short integer from the buffer.
 */
static int getUnsignedShort(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0xFF) << 8 |
      buf.getByte(offset + 1) & 0xFF;
}

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

/**
 * Reads a big-endian (31-bit) integer from the buffer.
 */
static int getUnsignedInt(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0x7F) << 24 |
      (buf.getByte(offset + 1) & 0xFF) << 16 |
      (buf.getByte(offset + 2) & 0xFF) <<  8 |
      buf.getByte(offset + 3) & 0xFF;
}

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

private static boolean match(byte[] prefix, ByteBuf buffer, int idx) {
    for (int i = 0; i < prefix.length; i++) {
      final byte b = buffer.getByte(idx + i);
      if (b != prefix[i]) {
        return false;
      }
    }
    return true;
  }
}

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

/**
 * If the given buffer is a {@link SaslListMechsRequest} message.
 */
public static boolean is(final ByteBuf buffer) {
  return buffer.getByte(0) == MessageUtil.MAGIC_REQ && buffer.getByte(1) == SASL_LIST_MECHS_OPCODE;
}

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

/**
 * Reads a big-endian unsigned medium integer from the buffer.
 */
static int getUnsignedMedium(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0xFF) << 16 |
      (buf.getByte(offset + 1) & 0xFF) <<  8 |
      buf.getByte(offset + 2) & 0xFF;
}

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

/**
 * Reads a big-endian signed integer from the buffer.
 */
static int getSignedInt(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0xFF) << 24 |
      (buf.getByte(offset + 1) & 0xFF) << 16 |
      (buf.getByte(offset + 2) & 0xFF) <<  8 |
      buf.getByte(offset + 3) & 0xFF;
}

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

/**
 * Reads a big-endian unsigned medium integer from the buffer.
 */
static int getUnsignedMedium(ByteBuf buf, int offset) {
  return (buf.getByte(offset)     & 0xFF) << 16 |
      (buf.getByte(offset + 1) & 0xFF) <<  8 |
      buf.getByte(offset + 2) & 0xFF;
}

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

@Override
protected byte _getByte(int index) {
  Component c = findComponent(index);
  return c.buf.getByte(index - c.offset);
}

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

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

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

@Override
protected byte _getByte(int index) {
  Component c = findComponent(index);
  return c.buf.getByte(index - c.offset);
}

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

@Override
public byte getByte(int index) {
  checkIndex(index, 1);
  return buffer.getByte(index);
}

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

@Override
protected byte _getByte(int index) {
  Component c = findComponent(index);
  return c.buf.getByte(index - c.offset);
}

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

@Override
protected byte _getByte(int index) {
  Component c = findComponent(index);
  return c.buf.getByte(index - c.offset);
}

代码示例来源: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
public byte getByte(int index) {
  checkIndex0(index, 1);
  return unwrap().getByte(idx(index));
}

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

@Override
public byte getByte(int index) {
  checkIndex0(index, 1);
  return unwrap().getByte(idx(index));
}

相关文章